I have a hierarchical gradle 3.1 project, which looks like this:
root
- build.gradle
- settings.gradle
- server (Java + WAR plugin)
- build.gradle
- client (Node plugin)
- build.gradle
The settings.gradle therefore looks like this:
include ':server', ':client'
What I would like to do now is to bundle the output of the :client:build task in the *.war file produced by the :server:war task. To do so, I need a dependency from :server:war to :client:build in order to ensure that the output files of :client:build are always present when I need to copy them in the :server:war task.
The question is: how does this work?
What I want to achieve here: whenever :server:war is executed, :client:build gets executed first.
Things I tried so far (none of them worked):
// in server/build.gradle
task war {
dependsOn ':client:build'
}
I also tried:
// in server/build.gradle
war.dependsOn = ':client:build'
... and also:
// in server/build.gradle
task war(dependsOn: ':client:build') {
}
None of the attempts above works. Any idea what I am doing wrong?