Hi,
I’m just getting started with Gradle. I imported a sample project into Eclipse. I added a dummy task in build.gradle.
task hello {...}
It showed up in the output of ‘gradle tasks’. However, that task didn’t show up in the ‘Gradle Tasks’ view. It’d be productive to have that feature. Not sure if I’m missing something.
Custom tasks show up in IntelliJ ‘Gradle Tasks’ window though.
I updated Eclipse and Buildship plugin. That involved a restart too. The task ‘hello’ started showing up in the Gradle Tasks’ view in Eclipse. Not sure if it’s due to the updates or the restart. Anyways, it’s working now.
I also find that the task I have defined in build.gradle doesn’t appear in the “Gradle Tasks View” in Eclipse. Refreshing (with the button described above) doesn’t cause it to appear, but it is listed under “other tasks” in the output of “gradle tasks”. The task itself runs fine if I run it from the gradle commandline though …
Tasks without a group are considered private and aren’t shown in buildship by default. This behaviour can be toggled so that private tasks are displayed
Yes, it has taken me by surprise too. On the other hand, it keeps the user from being confronted with a huge amount of low-level tasks, which is a good thing
Agreed that a mechanism for hiding some tasks is a good idea. But a null groupId as the switch is an odd choice IMHO. I’d prefer an explicit public = false or private = true or similar
It is a general convention of the TAPI that public tasks are those that belong to a non-null group. Any changes on the concept of task visibility (both in the TAPI and on the cmd line) first need to be designed and decided on in Gradle core (and the TAPI would then be adjusted accordingly).
Yup, I realise that’s how it works currently. I am a big fan of the principal of least surprise. A public / private flag is far less surprising than a null group.
OK, I have some tasks that are defined in a custom plugin. They were not grouped so I didn’t see them. I added a group in the constructor of the base class of all my tasks setGroup('build'). This did not make the task show up under build. The only way I could see it was by turning on “show all tasks” which brought it under ‘other’, not under ‘build’. Restarting Eclipse did not help this. Neither did “Refresh Gradle Project” nor the refresh button on the Gradle Tasks view, just as if I had not called setGroup.
Evidently my way of giving the task a group was not the right way. How may I give a group to a task that is defined in a plugin so that this would work?