Skip to content

Commit

Permalink
Remove Java 17 build, switch to 21 (#1700)
Browse files Browse the repository at this point in the history
* Remove Java 17 build, switch to 21
* Replace Java 17 in build pipeline

Signed-off-by: Holger Friedrich <[email protected]>
  • Loading branch information
holgerfriedrich authored Dec 15, 2024
1 parent d59dbc9 commit 9195cfe
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 45 deletions.
24 changes: 2 additions & 22 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }})
Expand Down Expand Up @@ -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:
Expand All @@ -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 }}
Expand Down
8 changes: 3 additions & 5 deletions distributions/openhab/src/main/resources/bin/karaf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 3 additions & 5 deletions distributions/openhab/src/main/resources/bin/karaf.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
2 changes: 1 addition & 1 deletion distributions/openhab/src/main/resources/bin/setenv
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions launch/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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)]) {
Expand All @@ -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
}
}
Expand Down
2 changes: 1 addition & 1 deletion launch/ModelGen.launch
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
<mapAttribute key="org.eclipse.debug.core.environmentVariables">
<mapEntry key="QT_QPA_PLATFORM" value=""/>
</mapAttribute>
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JRE for JavaSE-17"/>
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JRE for JavaSE-21"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:/org.openhab.core}/../.."/>
</launchConfiguration>
2 changes: 1 addition & 1 deletion launch/app/app.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -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',\
Expand Down
2 changes: 1 addition & 1 deletion launch/app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<oh.java.version>17</oh.java.version>
<oh.java.version>21</oh.java.version>
<maven.compiler.release>${oh.java.version}</maven.compiler.release>
<bnd.version>7.1.0</bnd.version>
</properties>
Expand Down
10 changes: 5 additions & 5 deletions launch/openHAB2.setup
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@
<setupTask
xsi:type="setup:PreferenceTask"
key="/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.codegen.targetPlatform"
value="17"/>
value="21"/>
<setupTask
xsi:type="setup:PreferenceTask"
key="/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.compliance"
value="17"/>
value="21"/>
<setupTask
xsi:type="setup:PreferenceTask"
key="/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.problem.assertIdentifier"
Expand Down Expand Up @@ -160,7 +160,7 @@
<setupTask
xsi:type="setup:PreferenceTask"
key="/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.source"
value="17"/>
value="21"/>
<setupTask
xsi:type="setup:PreferenceTask"
key="/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.taskCaseSensitive"
Expand Down Expand Up @@ -2316,8 +2316,8 @@
</setupTask>
<setupTask
xsi:type="jdt:JRETask"
version="JavaSE-17"
location="${jre.location-17}"/>
version="JavaSE-21"
location="${jre.location-21}"/>
<setupTask
xsi:type="setup:EclipseIniTask"
id="eclipse.ini.memory.start"
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@

<karaf.version>4.4.6</karaf.version>

<oh.java.version>17</oh.java.version>
<oh.java.version>21</oh.java.version>
<maven.compiler.release>${oh.java.version}</maven.compiler.release>

<sat.version>0.16.0</sat.version>
Expand Down Expand Up @@ -251,7 +251,7 @@
<version>3.6.3</version>
</requireMavenVersion>
<requireJavaVersion>
<version>[17.0,18.0),[21.0,22.0)</version>
<version>[21.0,22.0)</version>
</requireJavaVersion>
</rules>
</configuration>
Expand Down

0 comments on commit 9195cfe

Please sign in to comment.