You can add multiple dependencies.
task A << {
println 'Hello from A'
}
task B << {
println 'Hello from B'
}
task C << {
println 'Hello from C'
}
task D << {
println 'Hello from D'
}
Now you can define a set of dependencies:
B.dependsOn A
C.dependsOn B
D.dependsOn C
The output is:
> gradle -q D
Hello from A
Hello from B
Hello from C
Hello from D
Other example:
B.dependsOn A
D.dependsOn B
D.dependsOn C
The output is:
> gradle -q D
Hello from A
Hello from B
Hello from C
Hello from D