Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Print Gradle's current lifecycle phase

Tags:

gradle

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.

like image 520
Friedrich 'Fred' Clausen Avatar asked Nov 29 '25 13:11

Friedrich 'Fred' Clausen


1 Answers

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.

like image 136
Opal Avatar answered Dec 01 '25 20:12

Opal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!