Visitar URL original
Micronaut JacocoReportAggregationPlugin broken in Gradle 8.2 · Issue #25618 · gradle/gradle · GitHub
Skip to content

Micronaut JacocoReportAggregationPlugin broken in Gradle 8.2 #25618

Closed

Description

@tresat

Expected Behavior

Success with Gradle 8.1.1: https://ge.micronaut.io/s/z4db5b7satq26/dependencies?focusedDependency=WzAsMCwxMjM0LFswLDAsWzEyMzRdXV0&toggled=W1swXSxbMCwwXV0

Current Behavior

Failure with Gradle 8.2: https://ge.micronaut.io/s/kruw4j3titqcs/failure

Context (optional)

Selection of classDirectories in the JacocoReport task is failing due to too many matching variants when a project applies the jacoco-report-aggregation plugin and its project dependency applies the java-test-fixtures plugin and contains test fixtures, which also make a classes variant such as:

- Configuration ':micronaut-openapi-generator:testFixturesRuntimeElements' variant classes declares a component, preferably in the form of class files:

available. The failure is due to an ArtifactView that uses withVariantReselection(), the originating Configuration reported in the error message is not problematic. Reselection should not be used to select class directories here.

Steps to Reproduce

See new integration test in JacocoAggregationIntegrationTest or rerun the Micronaut build at this commit using Gradle 8.2.

Gradle version

8.2

Gradle version that used to work

8.1.1

Activity

  1. self-assigned this
    on Jul 5, 2023
  2. added this to the 8.2.1 milestone on Jul 5, 2023
  3. changed the title [-]Changes to Configuration breaks Micronaut TestAggregation usage in Gradle 8.2[/-] [+]Micronaut JacocoReportAggregationPlugin broken in Gradle 8.2[/+] on Jul 6, 2023
  4. asoftwareguy commented on Jul 6, 2023

    @asoftwareguy

    We are having the same issue in our project using jacocoAggregation:

    Could not determine the dependencies of task ':code-coverage-report:check'.
    > Could not create task ':code-coverage-report:testCodeCoverageReport'.
       > Could not resolve all files for configuration ':code-coverage-report:aggregateCodeCoverageReportResults'.
          > The consumer was configured to find a component, preferably in the form of class files. However we cannot choose between the following variants of project :app:
              - Configuration ':app:apiElements' variant classes declares a component, preferably in the form of class files:
                  - Unmatched attributes:
                      - Provides attribute 'artifactType' with value 'java-classes-directory' but the consumer didn't ask for it
                      - Provides a library but the consumer didn't ask for it
                      - Provides its dependencies declared externally but the consumer didn't ask for it
                      - Provides compatibility with Java 17 but the consumer didn't ask for it
                      - Provides compile-time but the consumer didn't ask for it
              - Configuration ':app:testFixturesRuntimeElements' declares a component, packaged as a jar:
                  - Unmatched attributes:
                      - Provides attribute 'artifactType' with value 'jar' but the consumer didn't ask for it
                      - Provides a library but the consumer didn't ask for it
                      - Provides its dependencies declared externally but the consumer didn't ask for it
                      - Provides compatibility with Java 17 but the consumer didn't ask for it
                      - Provides runtime but the consumer didn't ask for it
               ...
    
  5. tresat commented on Jul 6, 2023

    @tresat
    MemberAuthor

    @asoftwareguy - Looks like the same error. This fix should be available in Gradle 8.2.1, coming very soon.

  6. added a commit that references this issue on Jul 6, 2023
    9e5adaf
  7. marcphilipp commented on Jun 14, 2024

    @marcphilipp
    Contributor

    FWIW this change broke Jacoco aggregation in JUnit's build which uses a custom variant to use the shadow-transformed classes which was no longer resolved after removing withVariantReselection().

    Workaround: junit-team/junit-framework@45ad2b2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions