gradle: copy war to tomcat directory

前端 未结 9 1389
情话喂你
情话喂你 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:27

    Please, make sure the war archive is getting bundled before deploylocal is executed. Maybe, you could define a dependency:

    task deploylocal(dependsOn: build) << {
    

    NB There is a convention property in java plugin named libsDir. It allows you to reference build/libs directory in better way:

     task deploylocal(dependsOn: build) << {
        println "Copy from ${libsDir.getPath()} into ${tomcatHome}/webapps"
        copy{
          from libsDir
          into "${tomcatHome}/webapps"
          include '*.war'
        }
      }
    

提交回复
热议问题