This question is for gradle (>= 2.4). I would like to write a custom task like the following:
https://docs.gradle.org/current/userguide/custom_tasks.html
class GreetingTask extends DefaultTask {
@TaskAction
def greet() {
println 'hello from GreetingTask'
}
}
task hello(type: GreetingTask)
how can I make this task run during execution phase? Is passing an empty closure with
<< {
}
the only solution?
Edit
the task is supposed to be used in a multiproject build with several tasks as dependencies.
I'd like that the command gradle build
would build all the projects by saying something like
`build.dependsOn(hello)`
but seems that the task hello is called during configuration phase of the build.