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

Cannot compile on java version 19 #663

Open
clemens-tolboom opened this issue Feb 27, 2024 · 1 comment · May be fixed by #681
Open

Cannot compile on java version 19 #663

clemens-tolboom opened this issue Feb 27, 2024 · 1 comment · May be fixed by #681

Comments

@clemens-tolboom
Copy link
Collaborator

Having version 19.0.2

java --version
openjdk 19.0.2 2023-01-17
OpenJDK Runtime Environment (build 19.0.2+7-Ubuntu-0ubuntu322.04)
OpenJDK 64-Bit Server VM (build 19.0.2+7-Ubuntu-0ubuntu322.04, mixed mode, sharing)

then running ./gradlew build gives

./gradlew build
Downloading https://services.gradle.org/distributions/gradle-7.6.3-bin.zip
...........10%............20%...........30%............40%............50%...........60%............70%............80%...........90%............100%

Welcome to Gradle 7.6.3!

Here are the highlights of this release:
 - Added support for Java 19.
 - Introduced `--rerun` flag for individual task rerun.
 - Improved dependency block for test suites to be strongly typed.
 - Added a pluggable system for Java toolchains provisioning.

For more details see https://docs.gradle.org/7.6.3/release-notes.html

Starting a Gradle Daemon (subsequent builds will be faster)
Project version: v4.2.0-SNAPSHOT.1

> Configure project :
Project previous version (nyx): v4.1.0
Corrected version checking for optional snapshot: 4.2.0-SNAPSHOT
Project version : 4.2.0-SNAPSHOT
Git version     : 37c6f102
Git name-ref    : remotes/origin/feat/metrics

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':bootJar'.
> Could not resolve all task dependencies for configuration ':runtimeClasspath'.
   > Could not resolve project :armadillo.
     Required by:
         project :
      > No matching variant of project :armadillo was found. The consumer was configured to find a runtime of a library compatible with Java 17, packaged as a jar, preferably optimized for standard JVMs, and its dependencies declared externally but:
          - Variant 'apiElements' capability org.molgenis:armadillo:4.2.0-SNAPSHOT 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 19 and the consumer needed a runtime of a component compatible with Java 17
              - Other compatible attribute:
                  - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
          - Variant 'coverageDataElementsForTest' capability org.molgenis:armadillo:4.2.0-SNAPSHOT:
              - Incompatible because this component declares a component of category 'verification' and the consumer needed a library
              - Other compatible attributes:
                  - Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
                  - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
                  - Doesn't say anything about its target Java version (required compatibility with Java 17)
                  - Doesn't say anything about its elements (required them packaged as a jar)
                  - Doesn't say anything about its usage (required a runtime)
          - Variant 'mainSourceElements' capability org.molgenis:armadillo:4.2.0-SNAPSHOT declares a component, and its dependencies declared externally:
              - Incompatible because this component declares a component of category 'verification' and the consumer needed a library
              - Other compatible attributes:
                  - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
                  - Doesn't say anything about its target Java version (required compatibility with Java 17)
                  - Doesn't say anything about its elements (required them packaged as a jar)
                  - Doesn't say anything about its usage (required a runtime)
          - Variant 'runtimeElements' capability org.molgenis:armadillo:4.2.0-SNAPSHOT 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 19 and the consumer needed a component compatible with Java 17
              - Other compatible attribute:
                  - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
          - Variant 'testResultsElementsForTest' capability org.molgenis:armadillo:4.2.0-SNAPSHOT:
              - Incompatible because this component declares a component of category 'verification' and the consumer needed a library
              - Other compatible attributes:
                  - Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
                  - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
                  - Doesn't say anything about its target Java version (required compatibility with Java 17)
                  - Doesn't say anything about its elements (required them packaged as a jar)
                  - Doesn't say anything about its usage (required a runtime)

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

* Get more help at https://help.gradle.org

BUILD FAILED in 43s
@clemens-tolboom
Copy link
Collaborator Author

Easy fix is changing the java version in build.gradle

git diff
diff --git a/build.gradle b/build.gradle
index 52a1a9f8..6c1d39d4 100644
--- a/build.gradle
+++ b/build.gradle
@@ -22,8 +22,8 @@ plugins {
     id 'com.palantir.docker' version '0.35.0'
 }
 
-targetCompatibility = '17'
-sourceCompatibility = '17'
+targetCompatibility = '19'
+sourceCompatibility = '19'

@clemens-tolboom clemens-tolboom added this to the Sprint 217 milestone Feb 27, 2024
clemens-tolboom added a commit that referenced this issue Feb 27, 2024
@clemens-tolboom clemens-tolboom linked a pull request Feb 27, 2024 that will close this issue
@clemens-tolboom clemens-tolboom linked a pull request Mar 5, 2024 that will close this issue
@clemens-tolboom clemens-tolboom linked a pull request Mar 5, 2024 that will close this issue
@marikaris marikaris modified the milestones: Sprint 219, Backlog, Priority May 7, 2024
@marikaris marikaris removed the priority label May 7, 2024
@marikaris marikaris removed this from the Priority milestone May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants