What’s the best way to place all the contents of the war, except for the class files and dependencies, into a folder?
Right now, I’ve got the following:
task prepForIdea(type: Sync) {
destinationDir = file("$buildDir/forIdea")
with war
rootSpec.exclude("**/*.class")
rootSpec.exclude("**/*.jar")
}
gradle.taskGraph.whenReady { graph ->
if (graph.hasTask(prepForIdea)) {
rootProject.allprojects.each { prj ->
prj.tasks.withType(JavaCompile) {
it.enabled = false
}
}
}
}
It “works,” but it really feels really hacky. I also tried setting war.classpath = []
, but then I lost all task dependencies. Both “solutions” also mean I can’t run both prepForIdea and war in the same Gradle run.
What’s the best way to do this?