gradle Task dependencies Adding dependency using task object


task A << {
    println 'Hello from A'

task B << {
    println 'Hello from B'

B.dependsOn A

It is an alternative way to define the dependency instead of using the task name.

And the output is the same:

> gradle -q B
Hello from A
Hello from B