We can change the tasks execution order with the dependsOn method.
task A << {
println 'Hello from A'
}
task B(dependsOn: A) << {
println "Hello from B"
}
Adding `dependsOn: causes:
A task everytime before the B task execution.And the output is:
> gradle -q B
Hello from A
Hello from B