Reputation: 5354
By default, Gradle puts all WAR files that it creates in build/libs
when I run gradle build
on a Java project. How do I instruct Gradle to create a directory called dist
under build
and put all WAR files in that directory (i.e. build/dist
)?
Upvotes: 0
Views: 2150
Reputation: 5354
Another approach I found:
war.destinationDir = file "$buildDir/dist"
Upvotes: 0
Reputation: 5354
I created a new task called moveWar
that accomplished what I wanted:
task moveWar(type: Copy) {
from 'build/libs'
into 'build/dist'
}
Then I used build.finalizedBy moveWar
to move the WAR file in libs
to dist
after the build is finished.
Upvotes: 3