It so happens that this can be solved with a simple dependency management.
So, we have many modules. Now let's create additional tasks that depend on the modules under construction:
task aggregateJavadoc(type: Javadoc) { dependsOn subprojects.build task bundleJar(type: Jar) { dependsOn subprojects.build
Finally, our release task will look something like this:
task release() { dependsOn subprojects.build dependsOn aggregateJavadoc dependsOn bundleJar ... }
Subprojects will be built first; not because it is listed first, but because additional tasks depend on the building. Ordering an additional task does not matter. This is most important to me.
EDIT if one of your subprojects (i.e. modules) is a module other than java, then you will have a problem creating this project. I do this to group submodules, for example:
def javaModules() { subprojects.findAll {it.name.contains('jodd-')} }
and then instead of subprojects , use javaModules everywhere! For example:
configure(javaModules()) { apply plugin: 'java' ...
and
task prj { dependsOn javaModules().build }
btw, I use this 'dummy' prj for dependsOn for all of these additional projects that are build dependent to prevent repetition.
igr
source share