问题
task startSession << {
chant()
}
def chant() {
ant.echo(message: 'Repeat after me...')
}
3.times {
task "yayGradle$it" << {
println 'Gradle rocks'
}
}
yayGradle0.dependsOn startSession
yayGradle2.dependsOn yayGradle1, yayGradle0
task groupTherapy(dependsOn: yayGradle2)
In my script I have startSession task, groupTherapy task and three dynamically generated tasks yayGradle0-3. When I am executing:
gradle tasks
Part of the output is:
Other tasks
-----------
groupTherapy
Where are the other tasks? If I execute the command above with parameter --all
they are visible but not as indipendant tasks but like dependent on groupTherapy. Why Gradle doesn't show task startSession as separate task for example?
回答1:
gradle tasks
show tasks that no other task depends on, and tasks that have task.group
set. The idea is that these are the tasks that are clearly meant to be executed directly, whereas the (often many) remaining tasks aren't. gradle tasks --all
shows all tasks.
来源:https://stackoverflow.com/questions/23185321/why-cant-see-all-task-when-use-tasks-task-in-gradle