Gradle how to invoke task after finish execution phase

231 views Asked by At

Hai everyone currentlly i am confuse on how to invoking an gradle custom task during execution phase, usually invoke by using terminal console "gradle task hello", but now wanna invoke hello task during execution phase each time run the main(string args[]) java method will call the hello task does gradle allow to do that?

I have this code on build.gradle with:

task hello {
  doLast {
     println 'test'
  }
}

gradle.taskGraph.whenReady {
        taskGraph ->
            taskGraph.allTasks.each {
                Task t ->
                   t.dependsOn('hello')
            }
    }
0

There are 0 answers