anchor.diff:  
   Similarly with the ambiguous variant error, the goal is then to understand which variant is to be selected and see which attribute or capability can be tweaked on the consumer for this to happen.
   
  +[[sec:variant-visual]]
  +== Visualizing variant information
  +
  +=== Outgoing variants report
  +
  +The report task `outgoingVariants` shows the list of variants available for selection by consumers of the project. It displays the capabilities, attributes and artifacts for each variant. 
  +
  +This task is similar to the `dependencyInsight` <<viewing_debugging_dependencies.adoc#sec:identifying_reason_dependency_selection,reporting task>>.
  +
  +By default, `outgoingVariants` prints information about all variants.
  +It offers the optional parameter `--variant <variantName>` to select a single variant to display.
  +It also accepts the `--all` flag to include information about legacy and deprecated configurations.
  +
  +Here is the output of the `outgoingVariants` task on a freshly generated `java-library` project:
  +
  +[listing]
  +----
  +> Task :outgoingVariants
  +--------------------------------------------------
  +Variant apiElements
  +--------------------------------------------------
  +Description = API elements for main.
  +
  +Capabilities
  +    - new-java-library:lib:unspecified (default capability)
  +Attributes
  +    - org.gradle.category            = library
  +    - org.gradle.dependency.bundling = external
  +    - org.gradle.jvm.version         = 11
  +    - org.gradle.libraryelements     = jar
  +    - org.gradle.usage               = java-api
  +Artifacts
  +    - build/libs/lib.jar (artifactType = jar)
  +
  +Secondary Variants (*)
  +
  +    --------------------------------------------------
  +    Secondary Variant classes
  +    --------------------------------------------------
  +        Description = Directories containing compiled class files for main.
  +
  +        Attributes
  +            - org.gradle.category            = library
  +            - org.gradle.dependency.bundling = external
  +            - org.gradle.jvm.version         = 11
  +            - org.gradle.libraryelements     = classes
  +            - org.gradle.usage               = java-api
  +        Artifacts
  +            - build/classes/java/main (artifactType = java-classes-directory)
  +
  +--------------------------------------------------
  +Variant mainSourceElements (i)
  +--------------------------------------------------
  +Description = List of source directories contained in the Main SourceSet.
  +
  +Capabilities
  +    - new-java-library:lib:unspecified (default capability)
  +Attributes
  +    - org.gradle.category            = verification
  +    - org.gradle.dependency.bundling = external
  +    - org.gradle.verificationtype    = main-sources
  +Artifacts
  +    - src/main/java (artifactType = directory)
  +    - src/main/resources (artifactType = directory)
  +
  +--------------------------------------------------
  +Variant runtimeElements
  +--------------------------------------------------
  +Description = Elements of runtime for main.
  +
  +Capabilities
  +    - new-java-library:lib:unspecified (default capability)
  +Attributes
  +    - org.gradle.category            = library
  +    - org.gradle.dependency.bundling = external
  +    - org.gradle.jvm.version         = 11
  +    - org.gradle.libraryelements     = jar
  +    - org.gradle.usage               = java-runtime
  +Artifacts
  +    - build/libs/lib.jar (artifactType = jar)
  +
  +Secondary Variants (*)
  +
  +    --------------------------------------------------
  +    Secondary Variant classes
  +    --------------------------------------------------
  +        Description = Directories containing compiled class files for main.
  +
  +        Attributes
  +            - org.gradle.category            = library
  +            - org.gradle.dependency.bundling = external
  +            - org.gradle.jvm.version         = 11
  +            - org.gradle.libraryelements     = classes
  +            - org.gradle.usage               = java-runtime
  +        Artifacts
  +            - build/classes/java/main (artifactType = java-classes-directory)
  +
  +    --------------------------------------------------
  +    Secondary Variant resources
  +    --------------------------------------------------
  +        Description = Directories containing the project's assembled resource files for use at runtime.
  +
  +        Attributes
  +            - org.gradle.category            = library
  +            - org.gradle.dependency.bundling = external
  +            - org.gradle.jvm.version         = 11
  +            - org.gradle.libraryelements     = resources
  +            - org.gradle.usage               = java-runtime
  +        Artifacts
  +            - build/resources/main (artifactType = java-resources-directory)
  +
  +--------------------------------------------------
  +Variant testResultsElementsForTest (i)
  +--------------------------------------------------
  +Description = Directory containing binary results of running tests for the test Test Suite's test target.
  +
  +Capabilities
  +    - new-java-library:lib:unspecified (default capability)
  +Attributes
  +    - org.gradle.category              = verification
  +    - org.gradle.testsuite.name        = test
  +    - org.gradle.testsuite.target.name = test
  +    - org.gradle.testsuite.type        = unit-test
  +    - org.gradle.verificationtype      = test-results
  +Artifacts
  +    - build/test-results/test/binary (artifactType = directory)
  +
  +(i) Configuration uses incubating attributes such as Category.VERIFICATION.
  +(*) Secondary variants are variants created via the Configuration#getOutgoing(): ConfigurationPublications API which also participate in selection, in addition to the configuration itself.
  +----
  +
  +From this you can see the two main variants that are exposed by a java library, `apiElements` and `runtimeElements`.
  +Notice that the main difference is on the `org.gradle.usage` attribute, with values `java-api` and `java-runtime`.
  +As they indicate, this is where the difference is made between what needs to be on the _compile_ classpath of consumers, versus what's needed on the _runtime_ classpath.
  +
  +It also shows _secondary_ variants, which are exclusive to Gradle projects and not published.
  +For example, the secondary variant `classes` from `apiElements` is what allows Gradle to skip the JAR creation when compiling against a <<java_library_plugin.adoc#sec:java_library_classes_usage,`java-library` project>>.
  +
  +=== Resolvable configurations report
  +
  +Gradle also offers a complimentary report task called `resolvableConfigurations` that displays the _resolvable_ configurations of a project, which are those which can have dependencies added and be resolved.  The report will list their attributes and any configurations that they extend.  It will also list a summary of any attributes which will be affected by <<variant_attributes.adoc#sec:abm_compatibility_rules, Compatibility Rules>> or <<variant_attributes.adoc#sec:abm_disambiguation_rules, Disambiguation Rules>> during resolution.
  +
  +By default, `resolvableConfigurations` prints information about all purely resolvable configurations.
  +These are configurations that are marked resolvable but *not* marked consumable.
  +Though some resolvable configurations are also marked consumable, these are legacy configurations that should *not* have dependencies added in build scripts.
  +This report offers the optional parameter `--configuration <configurationName>` to select a single configuration to display.
  +It also accepts the `--all` flag to include information about legacy and deprecated configurations.
  +Finally, it accepts the `--recursive` flag to list in the extended configurations section those configurations which are extended _transitively_ rather than directly.
  +
  +Here is the output of the `resolvableConfigurations` task on a freshly generated `java-library` project:
  +
  +[listing]
  +----
  +> Task :resolvableConfigurations
  +--------------------------------------------------
  +Configuration annotationProcessor
  +--------------------------------------------------
  +Description = Annotation processors and their dependencies for source set 'main'.
  +
  +Attributes
  +    - org.gradle.category            = library
  +    - org.gradle.dependency.bundling = external
  +    - org.gradle.jvm.environment     = standard-jvm
  +    - org.gradle.libraryelements     = jar
  +    - org.gradle.usage               = java-runtime
  +
  +--------------------------------------------------
  +Configuration compileClasspath
  +--------------------------------------------------
  +Description = Compile classpath for source set 'main'.
  +
  +Attributes
  +    - org.gradle.category            = library
  +    - org.gradle.dependency.bundling = external
  +    - org.gradle.jvm.environment     = standard-jvm
  +    - org.gradle.jvm.version         = 11
  +    - org.gradle.libraryelements     = classes
  +    - org.gradle.usage               = java-api
  +Extended Configurations
  +    - compileOnly
  +    - implementation
  +
  +--------------------------------------------------
  +Configuration runtimeClasspath
  +--------------------------------------------------
  +Description = Runtime classpath of source set 'main'.
  +
  +Attributes
  +    - org.gradle.category            = library
  +    - org.gradle.dependency.bundling = external
  +    - org.gradle.jvm.environment     = standard-jvm
  +    - org.gradle.jvm.version         = 11
  +    - org.gradle.libraryelements     = jar
  +    - org.gradle.usage               = java-runtime
  +Extended Configurations
  +    - implementation
  +    - runtimeOnly
  +
  +--------------------------------------------------
  +Configuration testAnnotationProcessor
  +--------------------------------------------------
  +Description = Annotation processors and their dependencies for source set 'test'.
  +
  +Attributes
  +    - org.gradle.category            = library
  +    - org.gradle.dependency.bundling = external
  +    - org.gradle.jvm.environment     = standard-jvm
  +    - org.gradle.libraryelements     = jar
  +    - org.gradle.usage               = java-runtime
  +
  +--------------------------------------------------
  +Configuration testCompileClasspath
  +--------------------------------------------------
  +Description = Compile classpath for source set 'test'.
  +
  +Attributes
  +    - org.gradle.category            = library
  +    - org.gradle.dependency.bundling = external
  +    - org.gradle.jvm.environment     = standard-jvm
  +    - org.gradle.jvm.version         = 11
  +    - org.gradle.libraryelements     = classes
  +    - org.gradle.usage               = java-api
  +Extended Configurations
  +    - testCompileOnly
  +    - testImplementation
  +
  +--------------------------------------------------
  +Configuration testRuntimeClasspath
  +--------------------------------------------------
  +Description = Runtime classpath of source set 'test'.
  +
  +Attributes
  +    - org.gradle.category            = library
  +    - org.gradle.dependency.bundling = external
  +    - org.gradle.jvm.environment     = standard-jvm
  +    - org.gradle.jvm.version         = 11
  +    - org.gradle.libraryelements     = jar
  +    - org.gradle.usage               = java-runtime
  +Extended Configurations
  +    - testImplementation
  +    - testRuntimeOnly
  +
  +--------------------------------------------------
  +Compatibility Rules
  +--------------------------------------------------
  +Description = The following Attributes have compatibility rules defined.
  +
  +    - org.gradle.dependency.bundling
  +    - org.gradle.jvm.environment
  +    - org.gradle.jvm.version
  +    - org.gradle.libraryelements
  +    - org.gradle.plugin.api-version
  +    - org.gradle.usage
  +
  +--------------------------------------------------
  +Disambiguation Rules
  +--------------------------------------------------
  +Description = The following Attributes have disambiguation rules defined.
  +
  +    - org.gradle.category
  +    - org.gradle.dependency.bundling
  +    - org.gradle.jvm.environment
  +    - org.gradle.jvm.version
  +    - org.gradle.libraryelements
  +    - org.gradle.plugin.api-version
  +    - org.gradle.usage
  +----
  +
  +From this you can see the two main configurations used to resolve dependencies, `compileClasspath` and `runtimeClasspath`, as well as their corresponding test configurations.
  +
   [[sec:mapping-maven-ivy-to-variants]]
  -== Mapping from Maven/Ivy to variants
  +== Mapping from Maven/Ivy metadata to Gradle variants
   
   Neither Maven nor Ivy have the concept of _variants_, which are only natively supported by Gradle Module Metadata.
  -However, it doesn't prevent Gradle from working with them thanks to different strategies.
  +Gradle can still work with Maven and Ivy by using different variant derivation strategies.
   
   [NOTE]
   .Relationship with Gradle Module Metadata
   ====
  -Gradle Module Metadata is a metadata format for modules published on Maven, Ivy or other kind of repositories.
  -It is similar to `pom.xml` or `ivy.xml` files, but this format is _aware of variants_.
  -This means that if your project produces additional variants, those are available and published as part of the module metadata, which greatly improves the user experience.
  +Gradle Module Metadata is a metadata format for modules published on Maven, Ivy and other kinds of repositories.
  +It is similar to the `pom.xml` or `ivy.xml` metadata file, but this format contains details about variants.
   
   See the {metadata-file-spec}[Gradle Module Metadata specification] for more information.
   ====
   
   [[sub:maven-mapping-to-variants]]
  -=== Mapping of POM files to variants
  -
  -Modules published on a Maven repository are converted into variant-aware modules.
  -A particularity of Maven modules is that there is no way to know what kind of component is published.
  -In particular, there's no way to make the difference between a BOM representing a _platform_, and a BOM used as a super-POM.
  -Sometimes, it is even possible for a POM file to act both as a platform _and_ a library.
  -
  -As a consequence, Maven modules are derived into 6 distinct variants, which allows Gradle users to explain precisely what they depend on:
  +=== Mapping of Maven POM metadata to variants
  +
  +Modules published on a Maven repository are automatically converted into variant-aware modules.
  +
  +There is no way for Gradle to know which kind of component was published:
  +- a BOM that represents a Gradle platform
  +- a BOM used as a super-POM
  +- a POM that is both a platform _and_ a library
  +
  +The default strategy used by Java projects in Gradle is to derive 8 different variants:
   
   * 2 "library" variants (attribute `org.gradle.category` = `library`)
   ** the `compile` variant maps the `<scope>compile</scope>` dependencies.
  
positive.code: The rule creates an `apiElements` variant based on the `compile` configuration and a `runtimeElements` variant based on the `default` configuration of each ivy module.
  For each variant, it sets the corresponding <<#sec:variant-aware-matching,Java ecosystem attributes>>.
  Dependencies and artifacts of the variants are taken from the underlying configurations.
  If not all consumed ivy modules follow this pattern, the rule can be adjusted or only applied to a selected set of modules.
  
  For all ivy modules without variants, Gradle falls back to legacy configuration selection (i.e. Gradle does _not_ perform variant aware resolution for these modules).
  This means either the `default` configuration or the configuration explicitly defined in the dependency to the corresponding module is selected.
  (Note that explicit configuration selection is only possible from build scripts or ivy metadata, and should be avoided in favor of variant selection.)
  
  
negative.code: [[sub:ivy-mapping-to-variants]]
  === Mapping of Ivy files to variants
  
  Gradle has no built-in derivation strategy implemented for Ivy files.
  Ivy is a flexible format that allows you to publish arbitrary files and can be heavily customized.
  
  If you want to implement a derivation strategy for _compile_ and _runtime_ variants for Ivy, you can do so with <<component_metadata_rules.adoc#sec:component_metadata_rules,component metadata rule>>.
  The component metadata rules API allows you to <<component_metadata_rules.adoc#sec:component_metadata_rules_details,access Ivy configurations>> and create variants based on them.
  If you know that all the Ivy modules your are consuming have been published with Gradle without further customizations of the `ivy.xml` file, you can add the following rule to your build:
  
  .Deriving compile and runtime variants for Ivy metadata
  ====
  