Hi folks,
I have a multi-subproject Gradle build. Several of my subprojects generate wars and then explode them on disk just so that my Docker build can find the files it needs later, after the Gradle build finishes.
I’m exploding the wars using this snippet I copied off the web somewhere:
// This builds the server as a WAR file, though we don't actually use it.
// The important thing is the exploded WAR, from which the Dockerfile copies in
// all the app server's dependency jars.
task explodedWar(type: Copy) {
into "$buildDir/libs"
with war
}
war.finalizedBy "explodedWar"
Nothing in my build actually uses the output of this task, or at least, I don’t think it’s supposed to.
Since upgrading to Gradle 7.x, I’ve been getting lots of build warnings of the form:
- Gradle detected a problem with the following location: '/Users/me/myapp/server/build/libs/myapp-server-1.0-SNAPSHOT.jar'. Reason: Task ':myapp-content:distZip' uses this output of task ':myapp-server:explodedWar' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.4/userguide/validation_problems.html#implicit_dependency for more details about this problem.
Basically almost every task in every build file is generating this warning.
I just want the war to be generated and unpacked at the end of my build. What’s the best way to fix this?