gradle
8.5

# withModule

abstract fun withModule(id: Any, rule: Action<out Any>): ComponentMetadataHandler(source)

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

#### Return

this

#### 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

abstract fun withModule(id: Any, @DelegatesTo(value = ComponentMetadataDetails::class) rule: Closure<out Any>): ComponentMetadataHandler(source)

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.

#### Return

this

#### 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

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

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.

#### Return

this

#### 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

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

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

#### Return

this

#### 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