Home > Software engineering >  Execute builds only for some gradle modules in project
Execute builds only for some gradle modules in project

Time:09-23

I have a project utilities with a build.gradle. utilities has some modules named util, util2, util3, ... In a task I want to execute first :util2:build and :util5:build. But I do not know how to write such a task. This fails:

task executePreBuild() {
:util2:build
:util5:build
}

In commandline

gradlew clean :util2:build :util5:build

can be executed. But this is not my purporse. I want to execute

gradlew clean executePreBuild someOtherTask build

CodePudding user response:

This can be done by using dependsOn:

task executePreBuild {
    dependsOn ":util2:build"
    dependsOn ":util5:build"
}
  • Related