Package org.gradle.api.artifacts
Interface ComponentMetadataDetails
- All Superinterfaces:
- ComponentMetadata,- HasAttributes,- HasConfigurableAttributes<ComponentMetadataDetails>
@NonExtensible
public interface ComponentMetadataDetails
extends ComponentMetadata, HasConfigurableAttributes<ComponentMetadataDetails>
Describes a resolved component's metadata, which typically originates from
 a component descriptor (Ivy file, Maven POM). Some parts of the metadata can be changed
 via metadata rules (see 
ComponentMetadataHandler.- Since:
- 1.8
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddVariant(String name, String base, Action<? super VariantMetadata> action) Add a rule for adding a new variant to the component.voidaddVariant(String name, Action<? super VariantMetadata> action) Add a rule for adding a new empty variant to the component.voidallVariants(Action<? super VariantMetadata> action) Add a rule for adjusting all variants of a component.voidDeclares that this component belongs to a virtual platform, which should be considered during dependency resolution.voidDeclares that this component belongs to a platform, which should be considered during dependency resolution.voidmaybeAddVariant(String name, String base, Action<? super VariantMetadata> action) This is the lenient version ofaddVariant(String, String, Action).voidsetChanging(boolean changing) Sets whether the component is changing or immutable.voidSets the status of the component.voidsetStatusScheme(List<String> statusScheme) Sets the status scheme of the component.voidwithVariant(String name, Action<? super VariantMetadata> action) Add a rule for adjusting an existing variant of the component.Methods inherited from interface org.gradle.api.artifacts.ComponentMetadatagetId, getStatus, getStatusScheme, isChangingMethods inherited from interface org.gradle.api.attributes.HasAttributesgetAttributesMethods inherited from interface org.gradle.api.attributes.HasConfigurableAttributesattributes
- 
Method Details- 
setChangingvoid setChanging(boolean changing) Sets whether the component is changing or immutable.- Parameters:
- changing- whether the component is changing or immutable
 
- 
setStatusSets the status of the component. Must match one of the values inComponentMetadata.getStatusScheme().- Parameters:
- status- the status of the component
 
- 
setStatusSchemeSets the status scheme of the component. Values are ordered from least to most mature status.- Parameters:
- statusScheme- the status scheme of the component
 
- 
withVariantAdd a rule for adjusting an existing variant of the component.- Parameters:
- name- name of the variant to adjust (e.g. 'compile')
- action- the action to modify the variant
- Since:
- 4.4
 
- 
allVariantsAdd a rule for adjusting all variants of a component.- Parameters:
- action- the action to be executed on each variant.
- Since:
- 4.5
 
- 
addVariantAdd a rule for adding a new empty variant to the component.- Parameters:
- name- a name for the variant
- action- the action to populate the variant
- Since:
- 6.0
 
- 
addVariantAdd a rule for adding a new variant to the component. The new variant will be based on an existing variant or configurations of the component and initialized with the same attributes, capabilities, dependencies and artifacts. These can then be modified in the given configuration action. Whether the 'base' is already a variant (with attributes) or a plain configuration (without attributes) depends on the metadata source:- Gradle Module Metadata: all variants defined in the metadata are available as base
- POM Metadata: the 'compile' and 'runtime' variants with the Java ecosystem attributes are available as base
- Ivy Metadata: all configurations defined in the metadata are available as base
 VariantMetadata.withFiles(Action).- Parameters:
- name- a name for the variant
- base- name of the variant (pom or Gradle module metadata) or configuration (ivy.xml metadata) from which the new variant will be initialized
- action- the action to populate the variant
- Since:
- 6.0
 
- 
maybeAddVariantThis is the lenient version ofaddVariant(String, String, Action). The only difference is that this will do nothing (instead of throwing an error), if the 'base' variant does not exist for a component. This is particularly useful for rules that are applied toComponentMetadataHandler.all(Class)components.- Parameters:
- name- a name for the variant
- base- name of the variant (pom or Gradle module metadata) or configuration (ivy.xml metadata) from which the new variant will be initialized
- action- the action to populate the variant
- Since:
- 6.1
 
- 
belongsToDeclares that this component belongs to a virtual platform, which should be considered during dependency resolution.- Parameters:
- notation- the coordinates of the owner
- Since:
- 4.10
 
- 
belongsToDeclares that this component belongs to a platform, which should be considered during dependency resolution.- Parameters:
- notation- the coordinates of the owner
- virtual- must be set to true if the platform is a virtual platform, or false if it's a published platform
- Since:
- 5.0
 
 
-