gradle: copy war to tomcat directory

前端 未结 9 1256
情话喂你
情话喂你 2020-12-28 14:01

I\'m trying to write a Gradle task which copies generated war files to my local tomcat instance:

This isn\'t working and I\'m not sure how to debug it:



        
相关标签:
9条回答
  • 2020-12-28 14:46

    The WAR task is aware of the artifacts it generates.

    task deployToTomcat(type: Copy) {
        from war.archivePath
        into "${tomcatHome}/webapps"
    }
    
    0 讨论(0)
  • 2020-12-28 14:46

    I accomplished this with:

    task deploy (dependsOn: war){
        copy {
            from "build/libs"
            into "C:/dev/jetty-distribution-9.1.4.v20140401/webapps"
            include "*.war"
        }
    }
    

    running it like this:

    gradle deploy
    
    0 讨论(0)
  • 2020-12-28 14:52

    Alternatively, you might be able to leverage the gradle-tomcat-plugin

    0 讨论(0)
提交回复
热议问题