VersionMappingStrategy (Gradle API 9.7.0)
Description: declaration: package: org.gradle.api.publish, interface: VersionMappingStrategy

# 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 Type
  Method
  Description
  `void`
  `allVariants(Action<? super VariantVersionMappingStrategy> action)`
  Configures the version mapping strategy for all variants
  `void`
  `usage(String usage, Action<? super VariantVersionMappingStrategy> action)`
  A short hand method to configure the variants which matches the provided Usage attribute.
  `<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.

- ## Method Details

  - ### allVariants

    void allVariants(Action<? super VariantVersionMappingStrategy> action)
    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 find
      `attributeValue` - the attribute value
      `action` - the configuration action

  - ### usage

    void usage(String usage, Action<? super VariantVersionMappingStrategy> action)
    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 for
      `action` - the configuration action