jfrog / build-info

Artifactory's open integration layer for CI build servers
https://www.buildinfo.org
Apache License 2.0
148 stars 157 forks source link

4.33.16 breaks because of multiple variants of com.google.guava:guava:32.1.3-jre #792

Closed xehpuk closed 5 months ago

xehpuk commented 6 months ago

Describe the bug

> Could not resolve all artifacts for configuration ':classpath'.
   > Could not resolve com.google.guava:guava:32.1.3-jre.
     Required by:
         project : > org.jfrog.buildinfo:build-info-extractor-gradle:4.33.16
         project : > org.jfrog.buildinfo:build-info-extractor-gradle:4.33.16 > org.jfrog.buildinfo:build-info-extractor:2.41.17
         project : > org.jfrog.buildinfo:build-info-extractor-gradle:4.33.16 > org.jfrog.buildinfo:build-info-client:2.41.17
         project : > org.jfrog.buildinfo:build-info-extractor-gradle:4.33.16 > org.jfrog.buildinfo:build-info-api:2.41.17
      > The consumer was configured to find a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally. However we cannot choose between the following variants of com.google.guava:guava:32.1.3-jre:
          - androidRuntimeElements
          - jreRuntimeElements
        All of them match the consumer attributes:
          - Variant 'androidRuntimeElements' capabilities com.google.collections:google-collections:32.1.3-jre and com.google.guava:guava:32.1.3-jre declares a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally:
              - Unmatched attributes:
                  - Provides attribute 'org.gradle.jvm.environment' with value 'android' but the consumer didn't ask for it
                  - Provides release status but the consumer didn't ask for it
          - Variant 'jreRuntimeElements' capabilities com.google.collections:google-collections:32.1.3-jre and com.google.guava:guava:32.1.3-jre declares a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally:
              - Unmatched attributes:
                  - Provides attribute 'org.gradle.jvm.environment' with value 'standard-jvm' but the consumer didn't ask for it
                  - Provides release status but the consumer didn't ask for it
        The following variants were also considered but didn't match the requested attributes:
          - Variant 'androidApiElements' capabilities com.google.collections:google-collections:32.1.3-jre and com.google.guava:guava:32.1.3-jre declares a library compatible with Java 8, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares an API of a component and the consumer needed a runtime of a component
          - Variant 'jreApiElements' capabilities com.google.collections:google-collections:32.1.3-jre and com.google.guava:guava:32.1.3-jre declares a library compatible with Java 8, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares an API of a component and the consumer needed a runtime of a component

To Reproduce Use org.jfrog.buildinfo:build-info-extractor-gradle:4.33.16 and build.

Expected behavior Successful build.

Versions

Additional context Works with 4.33.15.

yahavi commented 5 months ago

@xehpuk Appreciate you bringing this matter to our attention. We attempted to replicate it on an Android project without success. Would you be open to generating a minimal reproducible case for this issue?

Thanks.

xehpuk commented 5 months ago

It's not an Android project, if that helps.

Sadly, it may take time for me to construct a minimal case.

ViToni commented 5 months ago

Encountered the same issue. Also a non-Android project.

ViToni commented 5 months ago

Seems to be related to https://github.com/jfrog/build-info/pull/789 and by that to https://github.com/google/guava/issues/6801.

ViToni commented 5 months ago

@xehpuk Which version of Gradle do you use? We had the issue when using Gradle 6.9 but the issue seems to have gone away by switching to Gradle 7.6.2.

xehpuk commented 5 months ago

@ViToni Gradle 6.8.1 and Java 8. 🫣

ViToni commented 5 months ago

@xehpuk Maybe give Gradle 7.6.2 a try. Depending on the plugins you use this is a no-brainer. We are using Java 8 as well and our only issue was an external Gradle Saxon task which didn't define inputs/outputs properly and made Gradle nag about it... Gradle 8.x might be a different beast.

yahavi commented 5 months ago

@xehpuk @ViToni Based on your inputs, we have removed Guava from the code. Version 4.33.17 has been released and includes the fix for this issue. Please feel free to use it and share your feedback.

xehpuk commented 5 months ago

@ViToni The project is in ultra-maintenance mode. Only touching it if I have to. 😅 @yahavi That seems to fix it for me, thanks! 🥳