How to get the running task stack instance?

For example:
uploadArchives dependsOn war
war dependsOn classes
classes dependsOn compileJava

so how do I find out how compileJava is triggered on runtime?

is compileJava is triggered by

  1. user running “gradle uploadArchives”
  2. user running “gradle war”
  3. user running “gradle classes”

thank you!

You might find the task tree plugin useful

General rule here is: If a task is a task dependency then it will be executed at runtime. Executed does not necessarily mean that its actions are executed. It could be UP-TO-DATE or SKIPPED.

To your question. compileJava is a task dependency all all the tasks you list: 1)-3)