Print Gradle's current lifecycle phase

I am learning Gradle and understanding at which point various things apply in the build lifecycle seems essential to making the most of Gradle. In order to double check my understanding I'd like to know if there is a way to print which phase the build cycle is in at particular points.

E.g. hypothetically

task aTask() {
    println 'Current phase : <call to hypothetical phase reporter>'
    doLast {
        println 'Current phase : <call to hypothetical phase reporter>'
    }
}

would then print

$ gradle -q aTask
Current phase : configuration
Current phase : execution

if I understand the phases correctly.

Upvotes: 3

Views: 618

Answers (1)

Opal
Opal

Reputation: 84784

Unfortunately there's no such mechanism. What can be useful in indicating the current phase of lifecycle are the following listeners: BuildListener, ProjectEvaluationListener, TaskExecutionGraphListener and TaskExecutionListener. logger statements may be added in appropriate method to know how the things are going.

Upvotes: 1

Related Questions