#With doLast():
task("testTask") {
doLast {
println "hello testTask"
}
}
#Without:
task("testTask") {
println "hello testTask"
}
#The doLast creates a task action that runs when the task executes.
#Without it, you’re running the code at configuration time on every build.
#Both of these print the line, but the first one only prints the line when the testTask is supposed to be executed.
#The second one runs it when the build is configured, even if the task should not run.