The actions performed by a task are often too complex or specific, and the task name cannot describe the task’s action sufficiently well. Moreover, build scripts usually consist of many tasks - whether explicitly defined or implicitly by the applied plugins - so a structure is required to help the user navigate through existing tasks.
Therefore, tasks should define a description and group to provide documentation and categorization for the user.
Users can find tasks easier and understand their purpose if they contain a description and are grouped into categories.
Assign the description and group properties in your task configuration.
tasks.register<DocsGenerate>("generateHtmlDocs") { // Noncompliant, does neither define "description" and "group"
title.set("Project docs")
outputDir.set(layout.buildDirectory.dir("docs"))
}
tasks.register<DocsGenerate>("generateHtmlDocs") { // Compliant, defines "description" and "group"
description = "Generates the HTML documentation for this project."
group = JavaBasePlugin.DOCUMENTATION_GROUP
title.set("Project docs")
outputDir.set(layout.buildDirectory.dir("docs"))
}