Giter VIP home page Giter VIP logo

Comments (9)

bmuschko avatar bmuschko commented on July 18, 2024

You should be able to set the WAR file via the following:

tasks.withType(TomcatRunWar) {
    webApp = <your-war-file>
}

from gradle-tomcat-plugin.

edimusrex avatar edimusrex commented on July 18, 2024

Adding the above throws the following error

A problem occurred evaluating root project 'iC'.
Could not find method withType() for arguments [task ':tomcatRunWar', build_8a9r4tsfqjq9meq9akmu6803e$_run_closure28@11e80ef] on task set of type org.gradle.api.internal.tasks.DefaultTaskContainer.

I have it written as so

tasks.withType(tomcatRunWar){
    dependsOn 'build_notest'
    webApp = 'build/dist/iC.war'
}

from gradle-tomcat-plugin.

bmuschko avatar bmuschko commented on July 18, 2024

So you can either configure all tasks of type TomcatRunWar (capital T):

tasks.withType(TomcatRunWar) {
    dependsOn 'build_notest'
    webApp = 'build/dist/iC.war'
}

Or you can configure just the task instance (if it does exist):

tomcatRunWar {
    dependsOn 'build_notest'
    webApp = 'build/dist/iC.war'
}

For more general information on configuring tasks, I'd suggest you ask on the Gradle forum. That's not really specific to this plugin.

from gradle-tomcat-plugin.

edimusrex avatar edimusrex commented on July 18, 2024

I'm sorry, I am a little confused with your answer. Above you said it would work and then you said it wouldn't? Could you please clarify? Thank you

from gradle-tomcat-plugin.

bmuschko avatar bmuschko commented on July 18, 2024

I think I misread your answer. You stated that it doesn't work for you because of error x. I thought you had said that it did work. Sorry, no coffee yet.

I removed the first sentence in my answer. It should make more sense now.

from gradle-tomcat-plugin.

edimusrex avatar edimusrex commented on July 18, 2024

I am with you on that. Changing the code to

tomcatRunWar {
    dependsOn 'build_notest'
    webApp = 'build/dist/iC.war'
}

Throws the following error

A problem occurred evaluating root project 'iC'.
Cannot cast object 'build/dist/iC.war' with class 'java.lang.String' to class 'java.io.File'

The other method throws the previous error I listed.

Thanks for the help

from gradle-tomcat-plugin.

bmuschko avatar bmuschko commented on July 18, 2024

The field webApp is of type java.io.File so you'll have to assign the right type (see the Javadocs of the task type).

It would have to look as such:

tomcatRunWar {
    dependsOn 'build_notest'
    webApp = file('build/dist/iC.war')
}

from gradle-tomcat-plugin.

edimusrex avatar edimusrex commented on July 18, 2024

That did the trick. Thank you for your help

from gradle-tomcat-plugin.

bmuschko avatar bmuschko commented on July 18, 2024

Sure thing.

from gradle-tomcat-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.