How does Gradle decide what tasks to list when you run the `tasks` task?

I wrote a build file for some colleagues and one of them ran gradle tasks to remind themselves about what the tasks are, but none of the tasks I had written appeared. I have learned to run gradle tasks --all reflexively, but is there any way I can change what the tasks task prints by default?

If it is in a group it is displayed, if not then not. :slight_smile:

1 Like

In a group? A “group”, you say? What’s a group in this context? (You may treat that as rhetorical, I’ll go look it up when I have a chance; I’m not sure I’ve previously encountered the notion of grouping tasks.)

Just literally set the group :slight_smile:

tasks.register("foo") {
    group = "bar"
}

=>

Bar tasks
---------
foo
2 Likes

Use group & description:

tasks.register("allDeps", org.gradle.api.tasks.diagnostics.DependencyReportTask) {
    it.group = "help"
    it.description = """Recurcively print dependencies for each module.
}

You see the list of groups with gradle tasks. For missing (non-group) tasks use gradle tasks --all.