Interface ComponentMetadataHandler
DependencyHandler of a build script. The rules can be defined in two different ways:
 - As an action directly when they are applied in the components section
- As an isolated class implementing the ComponentMetadataRuleinterface
Example shows a basic way of removing certain transitive dependencies from one of our dependencies.
 plugins {
     id 'java'
 }
 repositories {
     mavenCentral()
 }
 dependencies {
     components {
         withModule("jaxen:jaxen") {
             allVariants {
                 withDependencies {
                     removeAll { it.group in ["dom4j", "jdom", "xerces", "maven-plugins", "xml-apis", "xom"] }
                 }
             }
         }
     }
     implementation("jaxen:jaxen:1.1.3")
 }
 - Since:
- 1.8
- 
Method SummaryModifier and TypeMethodDescriptionAdds a rule closure that may modify the metadata of any resolved software component.all(Class<? extends ComponentMetadataRule> rule) Adds a class based rule that may modify the metadata of any resolved software component.all(Class<? extends ComponentMetadataRule> rule, Action<? super ActionConfiguration> configureAction) Adds a class based rule that may modify the metadata of any resolved software component.Adds a rule that may modify the metadata of any resolved software component.all(Action<? super ComponentMetadataDetails> rule) Adds a rule action that may modify the metadata of any resolved software component.withModule(Object id, Closure<?> rule) Adds a rule that may modify the metadata of any resolved software component belonging to the specified module.withModule(Object id, Class<? extends ComponentMetadataRule> rule) Adds a class based rule that may modify the metadata of any resolved software component belonging to the specified module.withModule(Object id, Class<? extends ComponentMetadataRule> rule, Action<? super ActionConfiguration> configureAction) Adds a class based rule that may modify the metadata of any resolved software component belonging to the specified module.withModule(Object id, Object ruleSource) Adds a rule that may modify the metadata of any resolved software component belonging to the specified module.withModule(Object id, Action<? super ComponentMetadataDetails> rule) Adds a rule that may modify the metadata of any resolved software component belonging to the specified module.
- 
Method Details- 
allAdds a rule action that may modify the metadata of any resolved software component.- Parameters:
- rule- the rule to be added
- Returns:
- this
 
- 
allAdds a rule closure that may modify the metadata of any resolved software component.The supplied rule closure must declare a ComponentMetadataDetailsas it's first parameter, allowing the component metadata to be modified.In addition, the rule can declare additional (read-only) parameters, which may provide extra details about the component. The order of these additional parameters is not significant. The following additional parameter types are supported: - IvyModuleDescriptor- additional Ivy-specific metadata. Rules declaring this parameter will only be invoked for components packaged as an Ivy module.
- PomModuleDescriptor- additional Maven-specific metadata. Rules declaring this parameter will only be invoked for components packaged as a POM module.
 - Parameters:
- rule- the rule to be added
- Returns:
- this
 
- 
allAdds a rule that may modify the metadata of any resolved software component.The ruleSource is an Object that has a single rule method annotated with Mutate.This rule method: - must return void.
- must have ComponentMetadataDetailsas the first parameter.
- may have an additional parameter of type IvyModuleDescriptororPomModuleDescriptor.
 - Parameters:
- ruleSource- the rule source object to be added
- Returns:
- this
 
- 
allAdds a class based rule that may modify the metadata of any resolved software component.- Parameters:
- rule- the rule to be added
- Returns:
- this
- Since:
- 4.9
 
- 
allComponentMetadataHandler all(Class<? extends ComponentMetadataRule> rule, Action<? super ActionConfiguration> configureAction) Adds a class based rule that may modify the metadata of any resolved software component. The rule itself is configured by the provided configure action.- Parameters:
- rule- the rule to be added
- configureAction- the rule configuration
- Returns:
- this
- Since:
- 4.9
 
- 
withModuleAdds 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- ModuleIdentifier
- rule- the rule to be added
- Returns:
- this
 
- 
withModuleComponentMetadataHandler withModule(Object id, @DelegatesTo(ComponentMetadataDetails.class) Closure<?> rule) 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- ModuleIdentifier
- rule- the rule to be added
- Returns:
- this
 
- 
withModuleAdds 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- ModuleIdentifier
- ruleSource- the rule source object to be added
- Returns:
- this
 
- 
withModuleAdds 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- ModuleIdentifier
- rule- the rule to be added
- Returns:
- this
- Since:
- 4.9
 
- 
withModuleComponentMetadataHandler withModule(Object id, Class<? extends ComponentMetadataRule> rule, Action<? super ActionConfiguration> configureAction) 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- ModuleIdentifier
- rule- the rule to be added
- Returns:
- this
- Since:
- 4.9
 
 
-