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

Unable to build on Java 1.8 #385

Open
notsocafe opened this issue Jan 29, 2024 · 1 comment
Open

Unable to build on Java 1.8 #385

notsocafe opened this issue Jan 29, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@notsocafe
Copy link

notsocafe commented Jan 29, 2024

Steps to reproduce :
1 - Clone repository
2 - Run ./gradlew (or equivalent) to initialize dev environment

Complete log :

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'mc-image-helper'.
> Could not resolve all files for configuration ':classpath'.
   > Could not resolve me.qoomon:gradle-git-versioning-plugin:6.4.3.
     Required by:
         project : > me.qoomon.git-versioning:me.qoomon.git-versioning.gradle.plugin:6.4.3
      > No matching variant of me.qoomon:gradle-git-versioning-plugin:6.4.3 was found. The consumer was configured to find a library for use during runtime, compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '8.1.1' but:
          - Variant 'apiElements' capability me.qoomon:gradle-git-versioning-plugin:6.4.3 declares a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a component for use during compile-time, compatible with Java 11 and the consumer needed a component for use during runtime, compatible with Java 8
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.1.1')
          - Variant 'javadocElements' capability me.qoomon:gradle-git-versioning-plugin:6.4.3 declares a component for use during runtime, 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 8)
                  - Doesn't say anything about its elements (required them packaged as a jar)
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.1.1')
          - Variant 'runtimeElements' capability me.qoomon:gradle-git-versioning-plugin:6.4.3 declares a library for use during runtime, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a component, compatible with Java 11 and the consumer needed a component, compatible with Java 8
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.1.1')
          - Variant 'sourcesElements' capability me.qoomon:gradle-git-versioning-plugin:6.4.3 declares a component for use during runtime, 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 8)
                  - Doesn't say anything about its elements (required them packaged as a jar)
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.1.1')
   > Could not resolve io.github.itzg:github-releaser-gradle-plugin:0.1.1.
     Required by:
         project : > io.github.itzg.github-releaser:io.github.itzg.github-releaser.gradle.plugin:0.1.1
      > No matching variant of io.github.itzg:github-releaser-gradle-plugin:0.1.1 was found. The consumer was configured to find a library for use during runtime, compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '8.1.1' but:
          - Variant 'apiElements' capability io.github.itzg:github-releaser-gradle-plugin:0.1.1 declares a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a component for use during compile-time, compatible with Java 17 and the consumer needed a component for use during runtime, compatible with Java 8
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.1.1')
          - Variant 'javadocElements' capability io.github.itzg:github-releaser-gradle-plugin:0.1.1 declares a component for use during runtime, 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 8)
                  - Doesn't say anything about its elements (required them packaged as a jar)
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.1.1')
          - Variant 'runtimeElements' capability io.github.itzg:github-releaser-gradle-plugin:0.1.1 declares a library for use during runtime, 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 8
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.1.1')
          - Variant 'sourcesElements' capability io.github.itzg:github-releaser-gradle-plugin:0.1.1 declares a component for use during runtime, 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 8)
                  - Doesn't say anything about its elements (required them packaged as a jar)
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.1.1')

Updating to a newer JDK (but older than 21) fixes the issue.
I haven't done Java in years and lack experience in Gradle, but I guess the error stems from dependencies requiring a newer Java version?
Metadata files describe the project as compatible with Java 1.8, unless I'm mistaken.

@itzg
Copy link
Owner

itzg commented Jan 29, 2024

Yes, as you saw

sourceCompatibility = JavaVersion.VERSION_1_8

The compiler will build for running on Java 8; however, Java is nice in that you can build with newer versions of the Java JDK compiler targeting older source code. Can leverage all the newest tooling stability and security fixes yet still produce code that'll run on an ancient Java version.

The build in GitHub runs with Java 17 JDK and I should really document that tooling "expectation" in the build.gradle. I'll do that for this issue.

As for the specific incompatibility, it's regarding a gradle plugin and as such is only a build-time constraint and is independent of the targeted source version.

@itzg itzg added the enhancement New feature or request label Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: To do
Development

No branches or pull requests

2 participants