I work with the following project structure
Project |-Subproject1 |-Subproject2 |build.gradle |settings.gradle
Submodules are included in settings.gradle and configured in the build.gradle root project.
I have 3 tasks
build (each subproject has this)deploy (this is a packaging mechanism for each subproject that should work on its own)finalizeDeployment (this needs to be called only once)
I want to be able to call
$gradle deploy <- all subprojects will be deployed, and finalization gets called once at the end
$gradle Subproject1:deploy <- Subproject1 is deployed, and finalize receives a call
build.gradle
configure(subprojects) { task build <<{ println "Do Build "+ project.name } task deploy(dependsOn:build){ println 'deploy '+project.name doLast{ finalizeDeployment.execute() } } } task finalizeDeployment{ dependsOn subprojects.deploy doLast{ println 'Finalize Deployment' } }
source share