public interface ComponentMetadataHandler
DependencyHandler of a build script. The rules can be defined in two different ways:
ComponentMetadataRule interfaceExample 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")
}
| Modifier and Type | Method | Description |
|---|---|---|
ComponentMetadataHandler |
all(Closure<?> rule) |
Adds a rule closure that may modify the metadata of any resolved software component.
|
ComponentMetadataHandler |
all(Class<? extends ComponentMetadataRule> rule) |
Adds a class based rule that may modify the metadata of any resolved software component.
|
ComponentMetadataHandler |
all(Class<? extends ComponentMetadataRule> rule,
Action<? super ActionConfiguration> configureAction) |
Adds a class based rule that may modify the metadata of any resolved software component.
|
ComponentMetadataHandler |
all(Object ruleSource) |
Adds a rule that may modify the metadata of any resolved software component.
|
ComponentMetadataHandler |
all(Action<? super ComponentMetadataDetails> rule) |
Adds a rule action that may modify the metadata of any resolved software component.
|
ComponentMetadataHandler |
withModule(Object id,
Closure<?> rule) |
Adds a rule that may modify the metadata of any resolved software component belonging to the specified module.
|
ComponentMetadataHandler |
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.
|
ComponentMetadataHandler |
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.
|
ComponentMetadataHandler |
withModule(Object id,
Object ruleSource) |
Adds a rule that may modify the metadata of any resolved software component belonging to the specified module.
|
ComponentMetadataHandler |
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.
|
ComponentMetadataHandler all(Action<? super ComponentMetadataDetails> rule)
rule - the rule to be addedComponentMetadataHandler all(Closure<?> rule)
The supplied rule closure must declare a ComponentMetadataDetails as 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.rule - the rule to be addedComponentMetadataHandler all(Object ruleSource)
The ruleSource is an Object that has a single rule method annotated with Mutate.
This rule method:
ComponentMetadataDetails as the first parameter.IvyModuleDescriptor or PomModuleDescriptor.ruleSource - the rule source object to be addedComponentMetadataHandler all(Class<? extends ComponentMetadataRule> rule)
rule - the rule to be addedComponentMetadataHandler all(Class<? extends ComponentMetadataRule> rule, Action<? super ActionConfiguration> configureAction)
rule - the rule to be addedconfigureAction - the rule configurationComponentMetadataHandler withModule(Object id, Action<? super ComponentMetadataDetails> rule)
id - the module to apply this rule to in "group:module" format or as a ModuleIdentifierrule - the rule to be addedComponentMetadataHandler withModule(Object id, Closure<?> rule)
The rule closure parameter is subject to the same requirements as all(groovy.lang.Closure).
id - the module to apply this rule to in "group:module" format or as a ModuleIdentifierrule - the rule to be addedComponentMetadataHandler withModule(Object id, Object ruleSource)
The rule source parameter is subject to the same requirements as all(Object).
id - the module to apply this rule to in "group:module" format or as a ModuleIdentifierruleSource - the rule source object to be addedComponentMetadataHandler withModule(Object id, Class<? extends ComponentMetadataRule> rule)
id - the module to apply this rule to in "group:module" format or as a ModuleIdentifierrule - the rule to be addedComponentMetadataHandler withModule(Object id, Class<? extends ComponentMetadataRule> rule, Action<? super ActionConfiguration> configureAction)
id - the module to apply this rule to in "group:module" format or as a ModuleIdentifierrule - the rule to be added