Tasks (with no dependency) not showing up

(AwoSwa) #1


I’m trying to have gradle show the tasks when I run the command

gradle tasks

These tasks do not have any dependency, but still are not showing up in the list of tasks.

Find below the version of Gradle installed:

Gradle 3.3

Build time:   2017-01-03 15:31:04 UTC
Revision:     075893a3d0798c0c1f322899b41ceca82e4e134b

Groovy:       2.4.7
Ant:          Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM:          1.8.0_66 (Oracle Corporation 25.66-b17)
OS:           Mac OS X 10.11.6 x86_64

These are petty simple tasks such as:

task hello {
        doLast {
        println "Hello World!"

and this is the result that the comman gradle tasks yields:


All tasks runnable from root project

Build Setup tasks
init - Initializes a new Gradle build. [incubating]
wrapper - Generates Gradle wrapper files. [incubating]

Help tasks
buildEnvironment - Displays all buildscript dependencies declared in root project '1.09-Exercise-ConfigureTaskDependencies'.
components - Displays the components produced by root project '1.09-Exercise-ConfigureTaskDependencies'. [incubating]
dependencies - Displays all dependencies declared in root project '1.09-Exercise-ConfigureTaskDependencies'.
dependencyInsight - Displays the insight into a specific dependency in root project '1.09-Exercise-ConfigureTaskDependencies'.
dependentComponents - Displays the dependent components of components in root project '1.09-Exercise-ConfigureTaskDependencies'. [incubating]
help - Displays a help message.
model - Displays the configuration model of root project '1.09-Exercise-ConfigureTaskDependencies'. [incubating]
projects - Displays the sub-projects of root project '1.09-Exercise-ConfigureTaskDependencies'.
properties - Displays the properties of root project '1.09-Exercise-ConfigureTaskDependencies'.
tasks - Displays the tasks runnable from root project '1.09-Exercise-ConfigureTaskDependencies'.

To see all tasks and more detail, run gradle tasks --all

To see more detail about a task, run gradle help --task <task>


Total time: 1.024 secs

As you can see the hello task is not being shown.
Hope that you can show me what might be the issue here.


(Chris Doré) #2

In order for the task to show up by default in the task report (without using --all), you need to assign the task to a group.

task xyz {
    group = 'something special'
    doLast { ... }