From 568e89587e601c219c0dfa0055d59ee458c3f565 Mon Sep 17 00:00:00 2001 From: Holger Friedrich Date: Fri, 15 Mar 2024 01:06:02 +0100 Subject: [PATCH 1/2] Allow for compiling with Java 21 * Support Java 17 and 21, default compilation to Java 17 class files * Add profile "j21" to compile to Java 21 class files * Upgrade SAT to 0.16.0 * Adapt Karaf scpipts to allow both Java 17 and 21 Signed-off-by: Holger Friedrich --- distributions/openhab/src/main/resources/bin/karaf | 4 +++- .../openhab/src/main/resources/bin/karaf.bat | 6 ++++-- launch/app/pom.xml | 10 ++++++++-- pom.xml | 14 ++++++++++---- 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/distributions/openhab/src/main/resources/bin/karaf b/distributions/openhab/src/main/resources/bin/karaf index 34c4f2f552..bc3a799280 100755 --- a/distributions/openhab/src/main/resources/bin/karaf +++ b/distributions/openhab/src/main/resources/bin/karaf @@ -160,7 +160,9 @@ init() { # Determine the JVM version and check that it is version 17 checkJvmVersion if [ "${VERSION}" -ne "17" ]; then - die "JVM must be version 17. JVM version ${VERSION} is unsupported (JAVA_HOME=$JAVA_HOME)" + if [ "${VERSION}" -ne "21" ]; then + die "JVM must be version 17 or 21. JVM version ${VERSION} is unsupported (JAVA_HOME=$JAVA_HOME)" + fi fi # Check if a root instance is already running diff --git a/distributions/openhab/src/main/resources/bin/karaf.bat b/distributions/openhab/src/main/resources/bin/karaf.bat index ae536d4d74..f9ccdc6f28 100644 --- a/distributions/openhab/src/main/resources/bin/karaf.bat +++ b/distributions/openhab/src/main/resources/bin/karaf.bat @@ -215,8 +215,10 @@ for /f tokens^=2-5^ delims^=.-_+^" %%j in ('"%JAVA%" -fullversion 2^>^&1') do ( ) if %JAVA_VERSION% NEQ 17 ( - call :warn "JVM must be version 17. JVM version %JAVA_VERSION% is unsupported (JAVA_HOME=%JAVA_HOME%)" - goto END + if %JAVA_VERSION% NEQ 21 ( + call :warn "JVM must be version 17 or 21. JVM version %JAVA_VERSION% is unsupported (JAVA_HOME=%JAVA_HOME%)" + goto END + ) ) if %JAVA_VERSION% GTR 8 ( diff --git a/launch/app/pom.xml b/launch/app/pom.xml index bd7b1a16cf..84042d24d0 100644 --- a/launch/app/pom.xml +++ b/launch/app/pom.xml @@ -15,8 +15,7 @@ UTF-8 UTF-8 17 - ${oh.java.version} - ${oh.java.version} + ${oh.java.version} 7.0.0 @@ -383,6 +382,13 @@ + + j21 + + 21 + ${oh.java.version} + + diff --git a/pom.xml b/pom.xml index 4bddab49ef..1722f9f4c7 100644 --- a/pom.xml +++ b/pom.xml @@ -64,10 +64,9 @@ 4.4.5 17 - ${oh.java.version} - ${oh.java.version} + ${oh.java.version} - 0.15.0 + 0.16.0 2.38.0 4.25 @@ -249,7 +248,7 @@ - [17.0,18.0) + [17.0,18.0),[21.0,22.0) @@ -319,6 +318,13 @@ + + j21 + + 21 + ${oh.java.version} + + From 2974eb4554701d46fe7b7255626bb9060afc3d2e Mon Sep 17 00:00:00 2001 From: Holger Friedrich Date: Wed, 3 Apr 2024 21:35:11 +0200 Subject: [PATCH 2/2] Bump maven-compiler-plugin to 3.13.0 Avoid ZipException with ejc >3.30.0. Signed-off-by: Holger Friedrich --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1722f9f4c7..42e1c35283 100644 --- a/pom.xml +++ b/pom.xml @@ -110,7 +110,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.11.0 + 3.13.0 org.apache.maven.plugins