Search code examples
gradleintellij-ideagroovygradle-kotlin-dslgradle-groovy-dsl

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.


Solution

  • 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'
    }