Package org.gradle.api.publish
Interface VersionMappingStrategy
public interface VersionMappingStrategy
The version mapping strategy for a publication. By default,
Gradle will use the declared versions of a dependency directly. However
in some situations it might be better to publish the resolved versions, or both
when the metadata format supports it.
- Since:
- 5.2
-
Method Summary
Modifier and TypeMethodDescriptionvoidallVariants(Action<? super VariantVersionMappingStrategy> action) Configures the version mapping strategy for all variantsvoidusage(String usage, Action<? super VariantVersionMappingStrategy> action) A short hand method to configure the variants which matches the provided Usage attribute.<T> voidvariant(Attribute<T> attribute, T attributeValue, Action<? super VariantVersionMappingStrategy> action) Configures the version mapping strategy for the variant which matches the provided attribute value.
-
Method Details
-
allVariants
Configures the version mapping strategy for all variants- Parameters:
action- the configuration action
-
variant
<T> void variant(Attribute<T> attribute, T attributeValue, Action<? super VariantVersionMappingStrategy> action) Configures the version mapping strategy for the variant which matches the provided attribute value.- Parameters:
attribute- the attribute to findattributeValue- the attribute valueaction- the configuration action
-
usage
A short hand method to configure the variants which matches the provided Usage attribute. This is the recommended way to configure the mapping strategy for the general case.- Parameters:
usage- the usage to look foraction- the configuration action
-