Package org.gradle.api.component

## Interface AdhocComponentWithVariants

- All Superinterfaces:
    `Named`, `SoftwareComponent`

      public interface AdhocComponentWithVariants
      extends SoftwareComponent

  A component which can declare additional variants corresponding to features. When published to Maven POMs, the dependencies of those variants are exposed as optional dependencies. When published to Gradle metadata, the variants are published as is.
  Since:
    5.3

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.gradle.api.Named

      `Named.Namer`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addVariantsFromConfiguration​(Configuration outgoingConfiguration, Action<? super ConfigurationVariantDetails> action)` | Declares an additional variant to publish, corresponding to an additional feature.
    `void` | `withVariantsFromConfiguration​(Configuration outgoingConfiguration, Action<? super ConfigurationVariantDetails> action)` | Further configure previously declared variants.

    - ### Methods inherited from interface org.gradle.api.Named

      `getName`

- - ### Method Detail

    - #### addVariantsFromConfiguration

          void addVariantsFromConfiguration​(Configuration outgoingConfiguration,
                                            Action<? super ConfigurationVariantDetails> action)

      Declares an additional variant to publish, corresponding to an additional feature.
      Parameters:
        `outgoingConfiguration` - the configuration corresponding to the variant to use as source of dependencies and artifacts
        `action` - the action to execute in order to determine if a configuration variant should be published or not

    - #### withVariantsFromConfiguration

          void withVariantsFromConfiguration​(Configuration outgoingConfiguration,
                                             Action<? super ConfigurationVariantDetails> action)

      Further configure previously declared variants.
      Parameters:
        `outgoingConfiguration` - the configuration corresponding to the variant to use as source of dependencies and artifacts
        `action` - the action to execute in order to determine if a configuration variant should be published or not
      Since:
        6.0