Possible to deploy war in exploded form without first creating the actual war?


(Mike Snare) #1

For reasons not worth mentioning (but legacy, of course) our webapp will not run as a war file. It must be exploded into the correct directory prior to launching tomcat. In order to achieve this I’m using the standard war plugin to create the war and then I’m exploding the contents of that war during the deploy phase using a copy task configured with a zipTree that wraps the war file.

This works, but is unfortunately one of the more time-consuming individual steps in the build. Is it possible to do what I’m doing but to avoid actually creating the war file? I.e. is there any way to use the configuration of that war as the input to a copy and get the results I’m looking for?


(René Groeschke) #2

Hey Mike,
the War task implements CopySpec that can be used as input for other copy operations.

task explodedWar(type:Copy){
    with(war)
    into("$buildDir/explodedWar")
}

(Mike Snare) #3

That works perfectly. Thanks!