I need some help with a Gradle build file. I have some subprojects which depend on tasks in the top folder. I just need to take a test
task and split it into two se
There are a few syntax solutions here:
runDifferentTests.dependsOn (":bTask")
runDifferentTests.dependsOn rootProject.bTask
task runDifferentTests(type : Test, dependsOn: [":bTask"]) {
...
}
task runDifferentTests(type : Test) {
dependsOn rootProject.bTask
...
}
//in the root build.gradle to apply to all subprojects at once.
subprojects {
runDifferentTests.dependsOn (":bTask")
}
runDifferentTests.dependsOn {
tasks.findAll { task -> task.name.startsWith('bTask') }
}
:
can be used to go a level up instead of rootProject depends on the preference and the project structure
Just remove the declaration in subprojects
and declare your dependency directly in the subproject, in C.gradle
:
runDifferentTests.dependsOn rootProject.bTask