Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I specify a category for a Gradle task?

I am writing a Gradle task in Intellij IDEA. I have noticed that in the Gradle window, the tasks appear under folders like so:

enter image description here

I am wondering, how can you give a task a 'category' so that it appears in a folder as shown in the screenshot?

All the tasks I create usually end up in other. I am also writing a custom plugin and want it to appear under a 'folder' name of my choosing. but I assume it'll be the same answer for when writing a task.

like image 611
Mendhak Avatar asked May 03 '15 22:05

Mendhak


People also ask

What does Gradle use to determine the order in which tasks can be?

Gradle determines the subset of the tasks, created and configured during the configuration phase, to be executed. The subset is determined by the task name arguments passed to the gradle command and the current directory. Gradle then executes each of the selected tasks.


Video Answer


2 Answers

You just need to set the group property of your task. Eg (from http://mrhaki.blogspot.co.uk/2012/06/gradle-goodness-adding-tasks-to.html)

task publish(type: Copy) {     from "sources"     into "output" }  configure(publish) {        group = 'Publishing'     description = 'Publish source code to output directory' } 
like image 95
tim_yates Avatar answered Sep 28 '22 06:09

tim_yates


Or, shorter syntax:

task publish(type: Copy) {   group = "Publishing"   description = "Publish source code to output directory"   from "sources"   into "output" } 
like image 31
Vadym Chekan Avatar answered Sep 28 '22 07:09

Vadym Chekan