I have written a gradle build file which several custom tasks. They are all like the following:
task runThis(type:JavaExec) {
doSomething()
}
When I enter "gradle tasks" in a terminal, none of the tasks I have written myself are listed. Only the standard list of tasks which appear when I run this command against a new project.
How do I get the tasks to be listed? And is it possible to print ONLY the custom written tasks?
I think
gradle tasks --all
should works, and your customized tasks are in Other tasks
category.
In intellij, there is a panel called Gradle projects
.
only the custom tasks: I write a simple task to do the trick:
// run with `gradle printTasks`
task printTasks << {
project.tasks.collect {
task ->
if (!task.group && task.name !='printTasks') {
println task.name
}
}
}