For AI agents: the documentation index is at https://docs.gradle.org/llms.txt. Request any page with the header Accept: text/markdown to get Markdown. User manual pages are also available as Markdown by replacing .html with .md in the URL.

registerFeature

abstract fun registerFeature(name: String, configureAction: Action<in FeatureSpec>)(source)

Registers a feature.

The new feature will have a default capability corresponding to the "group", "name" + feature name and version of this project. For example, if the group of the component is "org", that the project name is "lib" the version is "1.0" and the feature name is "myFeature", then a capability named "org:lib-my-feature:1.0" is automatically added.

In order to consume this feature in another module add a dependency like the following:

 dependencies {
     implementation(project(":lib")) {
         capabilities {
             requireCapability("org:lib-my-feature:1.0")
         }
     }
 }
The capability method can be used to refine the capabilities of this feature.

Since

5.3

Parameters

name

the name of the feature

configureAction

the configuration for the feature