molgenis / molgenis-service-armadillo

Armadillo; a DataSHIELD implementation, part of the MOLGENIS suite
https://molgenis.github.io/molgenis-service-armadillo/
GNU Lesser General Public License v3.0
7 stars 10 forks source link

Cannot compile on java version 19 #663

Open clemens-tolboom opened 6 months ago

clemens-tolboom commented 6 months ago

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 commented 6 months ago

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'