Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gradle: copy war to tomcat directory

Tags:

gradle

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:

 task deploylocal() << {     println "Copy from ${buildDir}\\libs into ${tomcatHome}/webapps"     copy{       from "${buildDir}\\libs"       into "${tomcatHome}/webapps"       include '*.war'     }   } 

Any ideas on what to do next?

like image 402
Dave Avatar asked Nov 17 '10 22:11

Dave


2 Answers

The WAR task is aware of the artifacts it generates.

task deployToTomcat(type: Copy) {     from war.archivePath     into "${tomcatHome}/webapps" } 
like image 65
Uriah Carpenter Avatar answered Sep 17 '22 15:09

Uriah Carpenter


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 
like image 33
Pasha Avatar answered Sep 16 '22 15:09

Pasha