Gradle Task Configuration vs Task Execution

gradle

Solution

Indeed: the 'println' statement of your task A will be executed during 'configuration' phase, whereas the 'println' statement of taks B will only be executed during 'execution' phase (assuming task B is run, directly or indirectly via task dependencies)

For more info, checkout: http://www.gradle.org/docs/current/userguide/build_lifecycle.html. Section 56.2 has a nice example (also demonstrating the third phase, being the 'initialization' phase, BTW)

Note: the "<<" is a shorthand notation for "doLast"

Problem

What is the difference between the code below? ``` task A { println 'configuration' } task B << { println 'action' } ``` I believe it has something to do with evaluation. ie task A is always evaluated whereas task B is only evaluated when its executed

Original source

Related problems