task testBoth { doFirst { println 'This is executed first during the execution phase.' } doLast { println 'This is executed last during the execution phase.' } println 'This is executed during the configuration phase as well.'}

The above example is self explanatory and tell you about the gradle build lifecycle phases. When run it will give
the following output.

This is executed during the initialization phase.This is executed during the configuration phase.This is also executed during the configuration phase.This is executed during the configuration phase as well.:testThis is executed during the execution phase.:testBothThis is executed first during the execution phase.This is executed last during the execution phase.