In a multi project build, how can I declare a dependency on a specific task within one project?


(richardconnell) #1

Specifically, I have one project (DDS) within the build with a task that generates java source code from idl files before building the project. Other projects within the build depend on the DDS project. How can I set up the top level build script to, in order, generate the idl files in the DDS project, build the DDS project, then build all the other projects? I tried adding the following line to the build.gradle in the DDS project: build.dependsOn idl This works within the context of the DDS project, but when the top level build script tries to build DDS, the generated files are placed in the top level directory instead of the DDS directory and the build fails.


(Peter Niederwieser) #2

build.dependsOn idl

It’s not the ‘build’ task that depends on ‘idl’, but the task that compiles the generated Java sources (e.g. ‘compileJava’).

when the top level build script tries to build DDS, the generated files are placed in the top level directory instead of the DDS directory and the build fails

Sounds like a bug in one of the build scripts.


(richardconnell) #3

Thanks, that was not clear at all from the documentation.