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

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

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, 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.

#### Return

this

#### Since

4.9

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

### Deprecated

Use withModule or withModule instead.

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