# Buildship Eclipse: Custom tasks in the 'Gradle Tasks' view

**URL:** <https://discuss.gradle.org/t/buildship-eclipse-custom-tasks-in-the-gradle-tasks-view/12172>\
**Category:** Buildship\
**Tags:** buildship, eclipse\
**Created:** [October 13, 2015, 9:45pm UTC](https://discuss.gradle.org/t/buildship-eclipse-custom-tasks-in-the-gradle-tasks-view/12172 "2015-10-13T21:45:24Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![phaninra](https://avatars.discourse-cdn.com/v4/letter/p/d26b3c/32.png) [@phaninra](https://discuss.gradle.org/u/phaninra)\
**Post date:** [October 13, 2015, 9:45pm UTC](https://discuss.gradle.org/t/buildship-eclipse-custom-tasks-in-the-gradle-tasks-view/12172/1 "2015-10-13T21:45:24Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![phaninra](https://avatars.discourse-cdn.com/v4/letter/p/d26b3c/32.png) [@phaninra](https://discuss.gradle.org/u/phaninra)\
**Post date:** [October 13, 2015, 10:38pm UTC](https://discuss.gradle.org/t/buildship-eclipse-custom-tasks-in-the-gradle-tasks-view/12172/2 "2015-10-13T22:38:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![donat](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/donat/32/7798_2.png) [@donat](https://discuss.gradle.org/u/donat)\
**Post date:** [October 14, 2015, 7:02am UTC](https://discuss.gradle.org/t/buildship-eclipse-custom-tasks-in-the-gradle-tasks-view/12172/3 "2015-10-14T07:02:51Z")

</div>

There is a ‘refresh’ icon on the task view’s toolbar, if you modify the task list you can use that to make your changes visible.

 ![](https://global.discourse-cdn.com/gradle/original/2X/9/93539d2129d033f0dfe9081fb2281c5be3fb6982.png)

---

<div class="post-metadata">

**Author:** ![geebotron](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/geebotron/32/4709_2.png) [@geebotron](https://discuss.gradle.org/u/geebotron)\
**Post date:** [March 16, 2016, 3:49pm UTC](https://discuss.gradle.org/t/buildship-eclipse-custom-tasks-in-the-gradle-tasks-view/12172/4 "2016-03-16T15:49:35Z")

</div>

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 …

---

<div class="post-metadata">

**Author:** ![Lance\_Java](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/lance_java/32/787_2.png) [@Lance\_Java](https://discuss.gradle.org/u/Lance_Java)\
**Post date:** [March 17, 2016, 12:06am UTC](https://discuss.gradle.org/t/buildship-eclipse-custom-tasks-in-the-gradle-tasks-view/12172/5 "2016-03-17T00:06:31Z")

</div>

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

More info [here](https://discuss.gradle.org/t/custom-tasks-are-not-being-included-in-the-gradle-tasks-view/12760)

FWIW I think this default behaviour is a bit strange myself

---

<div class="post-metadata">

**Author:** ![st\_oehme](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/st_oehme/32/5249_2.png) [@st\_oehme](https://discuss.gradle.org/u/st_oehme)\
**Post date:** [March 18, 2016, 7:31pm UTC](https://discuss.gradle.org/t/buildship-eclipse-custom-tasks-in-the-gradle-tasks-view/12172/6 "2016-03-18T19:31:11Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![Lance\_Java](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/lance_java/32/787_2.png) [@Lance\_Java](https://discuss.gradle.org/u/Lance_Java)\
**Post date:** [March 25, 2016, 8:24am UTC](https://discuss.gradle.org/t/buildship-eclipse-custom-tasks-in-the-gradle-tasks-view/12172/7 "2016-03-25T08:24:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![etiennestuder](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/etiennestuder/32/7153_2.png) [@etiennestuder](https://discuss.gradle.org/u/etiennestuder)\
**Post date:** [March 25, 2016, 8:46am UTC](https://discuss.gradle.org/t/buildship-eclipse-custom-tasks-in-the-gradle-tasks-view/12172/8 "2016-03-25T08:46:59Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![Lance\_Java](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/lance_java/32/787_2.png) [@Lance\_Java](https://discuss.gradle.org/u/Lance_Java)\
**Post date:** [March 25, 2016, 12:44pm UTC](https://discuss.gradle.org/t/buildship-eclipse-custom-tasks-in-the-gradle-tasks-view/12172/9 "2016-03-25T12:44:04Z")

</div>

Yup, I realise that’s how it works currently. I am a big fan of the [principal of least surprise](https://en.wikipedia.org/wiki/Principle_of_least_astonishment). A public / private flag is far less surprising than a null group.

---

<div class="post-metadata">

**Author:** ![sc1478](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/sc1478/32/4341_2.png) [@sc1478](https://discuss.gradle.org/u/sc1478)\
**Post date:** [April 22, 2016, 9:49pm UTC](https://discuss.gradle.org/t/buildship-eclipse-custom-tasks-in-the-gradle-tasks-view/12172/10 "2016-04-22T21:49:34Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Vampire](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/vampire/32/9082_2.png) [@Vampire](https://discuss.gradle.org/u/Vampire)\
**Post date:** [May 10, 2017, 3:12pm UTC](https://discuss.gradle.org/t/buildship-eclipse-custom-tasks-in-the-gradle-tasks-view/12172/11 "2017-05-10T15:12:05Z")

</div>

It seems you also need to set a description for it to land in the right category via TAPI.

---

<div class="post-metadata">

**Author:** ![st\_oehme](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/st_oehme/32/5249_2.png) [@st\_oehme](https://discuss.gradle.org/u/st_oehme)\
**Post date:** [May 10, 2017, 4:13pm UTC](https://discuss.gradle.org/t/buildship-eclipse-custom-tasks-in-the-gradle-tasks-view/12172/12 "2017-05-10T16:13:48Z")

</div>

You don’t need a description. If you can reproduce that it would be a bug, please file an issue if that’s the case.
