From 9195cfeb2e12bc4a934427f0ecf65f4a6d0f04ba Mon Sep 17 00:00:00 2001 From: Holger Friedrich Date: Sun, 15 Dec 2024 22:47:43 +0100 Subject: [PATCH] Remove Java 17 build, switch to 21 (#1700) * Remove Java 17 build, switch to 21 * Replace Java 17 in build pipeline Signed-off-by: Holger Friedrich --- .github/workflows/ci-build.yml | 24 ++----------------- .../openhab/src/main/resources/bin/karaf | 8 +++---- .../openhab/src/main/resources/bin/karaf.bat | 8 +++---- .../openhab/src/main/resources/bin/setenv | 2 +- launch/Jenkinsfile | 4 ++-- launch/ModelGen.launch | 2 +- launch/app/app.bndrun | 2 +- launch/app/pom.xml | 2 +- launch/openHAB2.setup | 10 ++++---- pom.xml | 4 ++-- 10 files changed, 21 insertions(+), 45 deletions(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 9d6d4d4887..05af3592bf 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -18,7 +18,7 @@ jobs: strategy: fail-fast: false matrix: - java: [ '17', '21', 'profile-j21' ] + java: [ '21' ] maven: [ '3.9.9' ] os: [ 'ubuntu-24.04' ] name: Build (Java ${{ matrix.java }}, ${{ matrix.os }}) @@ -46,25 +46,16 @@ jobs: - name: Set up Java ${{ matrix.java }} uses: actions/setup-java@v4 - if: ${{ matrix.java != 'profile-j21' }} with: distribution: 'temurin' java-version: ${{ matrix.java }} - - name: Set up Java ${{ matrix.java }} - uses: actions/setup-java@v4 - if: ${{ matrix.java == 'profile-j21' }} - with: - distribution: 'temurin' - java-version: ${{ 21 }} - - name: Set up Maven ${{ matrix.maven }} uses: stCarolas/setup-maven@v5 with: maven-version: ${{ matrix.maven }} - name: Build - if: ${{ matrix.java != 'profile-j21' }} id: build run: './.github/scripts/maven-build' env: @@ -74,19 +65,8 @@ jobs: -Dmaven.wagon.httpconnectionManager.ttlSeconds=25 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn - - name: Build - if: ${{ matrix.java == 'profile-j21' }} - id: build-j21 - run: './.github/scripts/maven-build clean verify -B -T 1.5C -U -Pj21' - env: - MAVEN_OPTS: >- - -Xmx2g - -Dmaven.wagon.http.retryHandler.count=5 - -Dmaven.wagon.httpconnectionManager.ttlSeconds=25 - -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn - - name: Upload Build Log - if: ${{ matrix.java == '17' && always() && ((steps.build.outcome == 'success') || (steps.build.outcome == 'failure') || (steps.build-j21.outcome == 'success') || (steps.build-j21.outcome == 'failure')) }} + if: ${{ always() && ((steps.build.outcome == 'success') || (steps.build.outcome == 'failure')) }} uses: actions/upload-artifact@v4 with: name: build-log-java-${{ matrix.java }}-${{ matrix.os }} diff --git a/distributions/openhab/src/main/resources/bin/karaf b/distributions/openhab/src/main/resources/bin/karaf index 34fe1aba7f..4764277e6a 100755 --- a/distributions/openhab/src/main/resources/bin/karaf +++ b/distributions/openhab/src/main/resources/bin/karaf @@ -157,12 +157,10 @@ init() { # Determine the JVM vendor detectJVM - # Determine the JVM version and check that it is version 17 + # Determine the JVM version and check that it is version 21 checkJvmVersion - if [ "${VERSION}" -ne "17" ]; then - if [ "${VERSION}" -ne "21" ]; then - die "JVM must be version 17 or 21. JVM version ${VERSION} is unsupported (JAVA_HOME=$JAVA_HOME)" - fi + if [ "${VERSION}" -ne "21" ]; then + die "JVM must be version 21. JVM version ${VERSION} is unsupported (JAVA_HOME=$JAVA_HOME)" 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 349db43a6c..712b7ba7ff 100644 --- a/distributions/openhab/src/main/resources/bin/karaf.bat +++ b/distributions/openhab/src/main/resources/bin/karaf.bat @@ -214,11 +214,9 @@ for /f tokens^=2-5^ delims^=.-_+^" %%j in ('"%JAVA%" -fullversion 2^>^&1') do ( if %%j==1 (set JAVA_VERSION=%%k) else (set JAVA_VERSION=%%j) ) -if %JAVA_VERSION% NEQ 17 ( - 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% NEQ 21 ( + call :warn "JVM must be version 21. JVM version %JAVA_VERSION% is unsupported (JAVA_HOME=%JAVA_HOME%)" + goto END ) if %JAVA_VERSION% GTR 8 ( diff --git a/distributions/openhab/src/main/resources/bin/setenv b/distributions/openhab/src/main/resources/bin/setenv index c2290092fe..bff2894829 100755 --- a/distributions/openhab/src/main/resources/bin/setenv +++ b/distributions/openhab/src/main/resources/bin/setenv @@ -138,7 +138,7 @@ locateJava() { fi if [ "x${JAVA_HOME}" = "x" ] && [ "${darwin}" = "true" ]; then - JAVA_HOME="$(/usr/libexec/java_home -v 11)" + JAVA_HOME="$(/usr/libexec/java_home -v 21)" fi if [ "x${JAVA}" = "x" ] && [ -r /etc/gentoo-release ] ; then JAVA_HOME=$(java-config --jre-home) diff --git a/launch/Jenkinsfile b/launch/Jenkinsfile index 6b14c65cb5..52943f5217 100644 --- a/launch/Jenkinsfile +++ b/launch/Jenkinsfile @@ -110,7 +110,7 @@ def releaseOpenHabComponent(componentName, branch, releaseVersion, nextVersion, sh "mvn unleash:perform -Dworkflow=unleash.phase1.workflow " + mvnOptions } - withMaven(jdk: 'OpenJDK 17', maven: 'maven (latest)', mavenOpts: '-Xms512m -Xmx2048m', mavenLocalRepo: '.repository', globalMavenSettingsConfig: env.MAVEN_GLOBAL_SETTINGS, options: [artifactsPublisher(disabled: true)]) { + withMaven(jdk: 'OpenJDK 21', maven: 'maven (latest)', mavenOpts: '-Xms512m -Xmx2048m', mavenLocalRepo: '.repository', globalMavenSettingsConfig: env.MAVEN_GLOBAL_SETTINGS, options: [artifactsPublisher(disabled: true)]) { sh "mvn deploy " + mvnReleaseOptions } withMaven(jdk: 'OpenJDK 11', maven: 'maven (latest)', mavenOpts: '-Xms512m -Xmx2048m', mavenLocalRepo: '.repository', globalMavenSettingsConfig: env.MAVEN_GLOBAL_SETTINGS, options: [artifactsPublisher(disabled: true)]) { @@ -137,7 +137,7 @@ def releaseOpenHabComponent(componentName, branch, releaseVersion, nextVersion, sh "mvn unleash:perform -Dworkflow=unleash.phase3.workflow " + mvnOptions } - withMaven(jdk: 'OpenJDK 17', maven: 'maven (latest)', mavenOpts: '-Xms512m -Xmx2048m', mavenLocalRepo: '.repository', globalMavenSettingsConfig: env.MAVEN_GLOBAL_SETTINGS, options: [artifactsPublisher(disabled: true)]) { + withMaven(jdk: 'OpenJDK 21', maven: 'maven (latest)', mavenOpts: '-Xms512m -Xmx2048m', mavenLocalRepo: '.repository', globalMavenSettingsConfig: env.MAVEN_GLOBAL_SETTINGS, options: [artifactsPublisher(disabled: true)]) { sh "mvn deploy " + mvnSnapshotOptions } } diff --git a/launch/ModelGen.launch b/launch/ModelGen.launch index 80123452a9..5695382646 100644 --- a/launch/ModelGen.launch +++ b/launch/ModelGen.launch @@ -15,6 +15,6 @@ - + diff --git a/launch/app/app.bndrun b/launch/app/app.bndrun index dad45f1499..e4b78c417d 100644 --- a/launch/app/app.bndrun +++ b/launch/app/app.bndrun @@ -69,7 +69,7 @@ feature.openhab-model-runtime-all: \ -runfw: org.eclipse.osgi --runee: JavaSE-17 +-runee: JavaSE-21 -runrequires.ee: \ bnd.identity;id='jakarta.xml.bind-api',\ diff --git a/launch/app/pom.xml b/launch/app/pom.xml index 455d70ecfb..b2dc149bbc 100644 --- a/launch/app/pom.xml +++ b/launch/app/pom.xml @@ -14,7 +14,7 @@ UTF-8 UTF-8 - 17 + 21 ${oh.java.version} 7.1.0 diff --git a/launch/openHAB2.setup b/launch/openHAB2.setup index ddc44f9d9f..1d39dc8cd1 100644 --- a/launch/openHAB2.setup +++ b/launch/openHAB2.setup @@ -92,11 +92,11 @@ + value="21"/> + value="21"/> + value="21"/> + version="JavaSE-21" + location="${jre.location-21}"/> 4.4.6 - 17 + 21 ${oh.java.version} 0.16.0 @@ -251,7 +251,7 @@ 3.6.3 - [17.0,18.0),[21.0,22.0) + [21.0,22.0)