api / org.gradle.api.artifacts.dsl / ComponentMetadataHandler / withModule

withModule

abstract fun withModule(id: Any, rule: Action<in ComponentMetadataDetails>): ComponentMetadataHandler

Adds a rule that may modify the metadata of any resolved software component belonging to the specified module.

Parameters

id - the module to apply this rule to in "group:module" format or as a org.gradle.api.artifacts.ModuleIdentifier

rule - the rule to be added

Return
this

abstract fun withModule(id: Any, rule: Closure<*>): ComponentMetadataHandler

Adds a rule that may modify the metadata of any resolved software component belonging to the specified module.

The rule closure parameter is subject to the same requirements as #all(groovy.lang.Closure).

Parameters

id - the module to apply this rule to in "group:module" format or as a org.gradle.api.artifacts.ModuleIdentifier

rule - the rule to be added

Return
this

abstract fun withModule(id: Any, ruleSource: Any): ComponentMetadataHandler

Adds a rule that may modify the metadata of any resolved software component belonging to the specified module.

The rule source parameter is subject to the same requirements as #all(Object).

Parameters

id - the module to apply this rule to in "group:module" format or as a org.gradle.api.artifacts.ModuleIdentifier

ruleSource - the rule source object to be added

Return
this

abstract fun withModule(id: Any, rule: Class<out ComponentMetadataRule>): ComponentMetadataHandler
abstract fun withModule(id: Any, rule: Class<out ComponentMetadataRule>, configureAction: Action<in ActionConfiguration>): ComponentMetadataHandler

Adds a class based rule that may modify the metadata of any resolved software component belonging to the specified module.

Parameters

id - the module to apply this rule to in "group:module" format or as a org.gradle.api.artifacts.ModuleIdentifier

rule - the rule to be added

Return
this

Since
4.9