How to build only exploded war with gradle?

For our project the creation of war file takes too long, so coming from maven we used to execute only

mvn war:exploded

What is the best way to achieve that with gradle?


1 Like

This will create a task that takes all the files that would be in the war file, but copies them into a folder instead of creating the war:

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

However, I’m not sure that you will see any performance improvement by doing this. Either way, the implementation of these tasks is still copying data from one place to another on disk, so the difference between the two is the performance of the zip algorithm vs. overhead for writing many small files. Personally, I’ve seen the zip algorithm normally win that race with large Java applications on modern hardware. If your application has a few very large files, I could see you being on the opposite side of the tipping point though.

1 Like

Thanks a lot! It is very useful.