Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 3.0.0 fails to resolve with JDK < 17 #73

Closed
ben-manes opened this issue Oct 10, 2022 · 3 comments
Closed

Version 3.0.0 fails to resolve with JDK < 17 #73

ben-manes opened this issue Oct 10, 2022 · 3 comments
Milestone

Comments

@ben-manes
Copy link

ben-manes commented Oct 10, 2022

When upgrading the new release if running Gradle with JDK 11 (build scan). If using 17 then it works fine (build scan).

Incompatible because this component declares an API of a component compatible with Java 17 and the consumer needed a runtime of a component compatible with Java 11

Configuration on demand is an incubating feature.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'caffeine'.
> Could not resolve all files for configuration ':classpath'.
   > Could not resolve net.ltgt.gradle:gradle-errorprone-plugin:3.0.0.
     Required by:
         project :
      > No matching variant of net.ltgt.gradle:gradle-errorprone-plugin:3.0.0 was found. The consumer was configured to find a runtime of a library compatible with Java 11, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '7.5.1' but:
          - Variant 'apiElements' capability net.ltgt.gradle:gradle-errorprone-plugin:3.0.0 declares a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares an API of a component compatible with Java 17 and the consumer needed a runtime of a component compatible with Java 11
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '7.5.1')
          - Variant 'javadocElements' capability net.ltgt.gradle:gradle-errorprone-plugin:3.0.0 declares a runtime of a component, and its dependencies declared externally:
              - Incompatible because this component declares documentation and the consumer needed a library
              - Other compatible attributes:
                  - Doesn't say anything about its target Java version (required compatibility with Java 11)
                  - Doesn't say anything about its elements (required them packaged as a jar)
                  - Doesn't say anything about org.gradle.plugin.api-version (required '7.5.1')
          - Variant 'runtimeElements' capability net.ltgt.gradle:gradle-errorprone-plugin:3.0.0 declares a runtime of a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a component compatible with Java 17 and the consumer needed a component compatible with Java 11
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '7.5.1')
          - Variant 'sourcesElements' capability net.ltgt.gradle:gradle-errorprone-plugin:3.0.0 declares a runtime of a component, and its dependencies declared externally:
              - Incompatible because this component declares documentation and the consumer needed a library
              - Other compatible attributes:
                  - Doesn't say anything about its target Java version (required compatibility with Java 11)
                  - Doesn't say anything about its elements (required them packaged as a jar)
                  - Doesn't say anything about org.gradle.plugin.api-version (required '7.5.1')

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org
@tbroyer
Copy link
Owner

tbroyer commented Oct 10, 2022

Just noticed that as well. I'll do a 3.0.1 soon, built with JDK 8. That's a side effect of moving to a more recent Gradle version and/or plugin-publish that published Gradle module metadata.

@ben-manes
Copy link
Author

no problem! I think you can use -release to have a newer JDK target an older version. I believe this works better than the target version which used to include newer method calls (hence animal sniffer), but I never trusted it enough to try and use in a release process.

@tbroyer
Copy link
Owner

tbroyer commented Oct 11, 2022

This is not even a problem with the binary, only with metadata: the Gradle Module Metadata says that it targets Java 17; the binary correctly targets Java 8 though (this is Kotlin, and the kotlin-dsl plugin configures it for Java 8 as a target) so it would work if Gradle accepted to resolve the dependency.
You can tell Gradle to ignore the Gradle Module Metadata using this declaration in your settings script (Kotlin DSL here, adapt accordingly for the Groovy DSL):

pluginManagement {
    repositories {
        gradlePluginPortal {
            (this as MavenArtifactRepository).metadataSources {
                mavenPom()
                ignoreGradleMetadataRedirection()
            }
        }
    }
}

Anyway, I just released v3.0.1 that fixes that (and enforces it for future releases).

@tbroyer tbroyer closed this as completed Oct 11, 2022
@tbroyer tbroyer changed the title Java 11 support (3.0) Version 3.0.0 fails to resolve with JDK < 17 Oct 11, 2022
@tbroyer tbroyer added this to the 3.0.1 milestone Oct 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants