Custom tasks are not being included in the Gradle Tasks View

issue-resolved
buildship
eclipse

(Jonathan Aguin) #1

Hi,

I have a multi project build with the following Gradle root script:

subprojects {
    apply plugin: 'java'

    dependencies {
        testCompile 'junit:junit:4.12'
    }

    task hello {
    	doLast {
    		print "hello"
    	}
    }
}

The setting file includes two subprojects: webservice and shared.
From the command line if I execute:

$ ./gradlew :webservice:tasks

------------------------------------------------------------
All tasks runnable from project :webservice
------------------------------------------------------------

Build tasks
-----------
assemble - Assembles the outputs of this project.
build - Assembles and tests this project.
buildDependents - Assembles and tests this project and all projects that depend on it.
buildNeeded - Assembles and tests this project and all projects it depends on.
classes - Assembles main classes.
clean - Deletes the build directory.
jar - Assembles a jar archive containing the main classes.
testClasses - Assembles test classes.
war - Generates a war archive with all the compiled classes, the web-app content and the libraries.

Documentation tasks
-------------------
javadoc - Generates Javadoc API documentation for the main source code.

Help tasks
----------
components - Displays the components produced by project ':webservice'. [incubating]
dependencies - Displays all dependencies declared in project ':webservice'.
dependencyInsight - Displays the insight into a specific dependency in project ':webservice'.
help - Displays a help message.
model - Displays the configuration model of project ':webservice'. [incubating]
projects - Displays the sub-projects of project ':webservice'.
properties - Displays the properties of project ':webservice'.
tasks - Displays the tasks runnable from project ':webservice'.

Verification tasks
------------------
check - Runs all checks.
test - Runs the unit tests.

Other tasks
-----------
hello

As you can see “hello” is listed as Other tasks.
If I import the project to Eclipse (Luna) using Buildship 1.0.6, the Gradle Tasks View is missing such task.
I am using using Gradle 2.8, if it helps.

Thanks


Buildship Eclipse: Custom tasks in the 'Gradle Tasks' view
(Etienne Studer) #2

Hi Jonathan

By default, Buildship only shows the public tasks. Public tasks are defined as those which belong to a non-null group. If you want to see the private tasks, too, click on the little arrow in the upper right-hand corner of the tasks View and adjust the filter to include ‘non-public’ tasks.

Etienne


Gradle tasks not shown in eclipse
(Jonathan Aguin) #3

Thanks! I did’t know about that kind of visibility for tasks.


(Lincoln Dlamini) #4

Thanks alot for this , I had the same issue, solved my problem