ComponentMetadataHandler

API Documentation:ComponentMetadataHandler

Note: This class is incubating and may change in a future version of Gradle.

Allows to modify the metadata of depended-on software components.

Example:

dependencies {
    components {
        eachComponent { ComponentMetadataDetails details ->
            if (details.id.group == "org.foo") {
                def version = details.id.version
                // assuming status is last part of version string
                details.status = version.substring(version.lastIndexOf("-") + 1)
                details.statusScheme = ["bronze", "silver", "gold", "platinum"]
            }
        }
    }
}

Properties

No properties

Methods

MethodDescription
eachComponent(rule)
Incubating

Adds a rule to modify the metadata of depended-on software components. For example, this allows to set a component's status and status scheme from within the build script, overriding any value specified in the component descriptor.

eachComponent(rule)
Incubating

Adds a rule to modify the metadata of depended-on software components. For example, this allows to set a component's status and status scheme from within the build script, overriding any value specified in the component descriptor.

Script blocks

No script blocks

Method details

void eachComponent(Closure<?> rule)

Note: This method is incubating and may change in a future version of Gradle.

Adds a rule to modify the metadata of depended-on software components. For example, this allows to set a component's status and status scheme from within the build script, overriding any value specified in the component descriptor.

The rule can declare one or multiple parameters, depending on which metadata it is interested in. The order of parameters is irrelevant. The following parameter types are supported:

  • ComponentMetadataDetails Core metadata which is provided for every kind of component. When declaring this parameter, the type may be omitted.
  • IvyModuleMetadata Additional Ivy-specific metadata. Rules declaring this parameter will only be invoked for Ivy components.

void eachComponent(Action<? super ComponentMetadataDetails> rule)

Note: This method is incubating and may change in a future version of Gradle.

Adds a rule to modify the metadata of depended-on software components. For example, this allows to set a component's status and status scheme from within the build script, overriding any value specified in the component descriptor.