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
    • Method Detail

      • addVariantsFromConfiguration

        void addVariantsFromConfiguration​(Configuration outgoingConfiguration,
                                          Action<? super ConfigurationVariantDetails> action)
        Declares an additional variant to publish, corresponding to an additional feature.

        This can be used to determine if the variant should be published or not, and to configure various options specific to the publishing format.

        Parameters:
        outgoingConfiguration - the configuration corresponding to the variant to use as source of dependencies and artifacts
        action - action executed to configure the variant prior to publishing
      • withVariantsFromConfiguration

        void withVariantsFromConfiguration​(Configuration outgoingConfiguration,
                                           Action<? super ConfigurationVariantDetails> action)
        Further configure previously declared variants.

        The action can be used to determine if the variant should be published or not, and to configure various options specific to the publishing format. Note that if multiple actions are added, they are executed in the order they were added.

        Parameters:
        outgoingConfiguration - the configuration corresponding to the variant to configure with a given action
        action - an additional action to be executed to configure the variant prior to publishing
        Throws:
        InvalidUserDataException - if the specified variant was not already added to this component