This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git
The following commit(s) were added to refs/heads/main by this push:
new d440818b397 Downgrade minimum JDK requirement from 21 to 17 (#1718)
d440818b397 is described below
commit d440818b397a97ccaf6015c11b2c02844f5bcf9e
Author: Andrea Cosentino <[email protected]>
AuthorDate: Thu Mar 19 09:25:54 2026 +0100
Downgrade minimum JDK requirement from 21 to 17 (#1718)
Lower the compiler source/target/release to JDK 17 across Maven,
GitHub Actions, and Jenkins pipelines. CI PR builds now test both
JDK 17 and 21. CamelVirtualThreadsTest uses reflection for the
Thread.isVirtual() call so it compiles on JDK 17 and is skipped
on runtimes below 21.
Signed-off-by: Andrea Cosentino <[email protected]>
---
.github/workflows/automatic-sync-main.yml | 2 +-
.github/workflows/generate-sbom-main.yml | 2 +-
.github/workflows/pr-build-main.yml | 2 +-
Jenkinsfile.sb | 2 +-
Jenkinsfile.sb.deploy | 2 +-
Jenkinsfile.sb.ppc64le | 2 +-
.../camel/spring/boot/CamelVirtualThreadsTest.java | 19 ++++++++++++++++---
pom.xml | 6 +++---
8 files changed, 25 insertions(+), 12 deletions(-)
diff --git a/.github/workflows/automatic-sync-main.yml
b/.github/workflows/automatic-sync-main.yml
index abad8d1ca7b..595e3e04c68 100644
--- a/.github/workflows/automatic-sync-main.yml
+++ b/.github/workflows/automatic-sync-main.yml
@@ -38,7 +38,7 @@ jobs:
uses: actions/setup-java@v5
with:
distribution: 'temurin'
- java-version: 21
+ java-version: 17
cache: 'maven'
- name: Build Camel Project
run: ./mvnw -V --no-transfer-progress -Dquickly clean install
diff --git a/.github/workflows/generate-sbom-main.yml
b/.github/workflows/generate-sbom-main.yml
index dfdc779336c..de553ee6302 100644
--- a/.github/workflows/generate-sbom-main.yml
+++ b/.github/workflows/generate-sbom-main.yml
@@ -40,7 +40,7 @@ jobs:
uses: actions/setup-java@v5
with:
distribution: 'temurin'
- java-version: 21
+ java-version: 17
cache: 'maven'
- name: Build Camel Project
run: ./mvnw -B -V --no-transfer-progress -Dquickly install
diff --git a/.github/workflows/pr-build-main.yml
b/.github/workflows/pr-build-main.yml
index d3af89aabc5..798367f86a2 100644
--- a/.github/workflows/pr-build-main.yml
+++ b/.github/workflows/pr-build-main.yml
@@ -37,7 +37,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
- java: ['21']
+ java: ['17', '21']
steps:
- uses: actions/checkout@v6
with:
diff --git a/Jenkinsfile.sb b/Jenkinsfile.sb
index 36ace78e5a8..ec891b8b952 100644
--- a/Jenkinsfile.sb
+++ b/Jenkinsfile.sb
@@ -19,7 +19,7 @@
def LOCAL_REPOSITORY = env.LOCAL_REPOSITORY ?:
'/home/jenkins/jenkins-slave/maven-repositories/0'
def AGENT_LABEL = env.AGENT_LABEL ?: 'ubuntu'
-def JDK_NAME = env.JDK_NAME ?: 'jdk_21_latest'
+def JDK_NAME = env.JDK_NAME ?: 'jdk_17_latest'
def MAVEN_PARAMS = '-U -B -e -fae -V
-Dmaven.repo.local=/home/jenkins/.m2/repository -Dmaven.compiler.fork=true'
diff --git a/Jenkinsfile.sb.deploy b/Jenkinsfile.sb.deploy
index 3b18bbf29c1..79f76d59584 100644
--- a/Jenkinsfile.sb.deploy
+++ b/Jenkinsfile.sb.deploy
@@ -19,7 +19,7 @@
def LOCAL_REPOSITORY = env.LOCAL_REPOSITORY ?:
'/home/jenkins/jenkins-slave/maven-repositories/0'
def AGENT_LABEL = env.AGENT_LABEL ?: 'ubuntu'
-def JDK_NAME = env.JDK_NAME ?: 'jdk_21_latest'
+def JDK_NAME = env.JDK_NAME ?: 'jdk_17_latest'
def MAVEN_PARAMS = "-U -B -e -fae -V -Dnoassembly -Dmaven.compiler.fork=true "
diff --git a/Jenkinsfile.sb.ppc64le b/Jenkinsfile.sb.ppc64le
index 0a791730800..e16c6f019b8 100644
--- a/Jenkinsfile.sb.ppc64le
+++ b/Jenkinsfile.sb.ppc64le
@@ -19,7 +19,7 @@
def LOCAL_REPOSITORY = env.LOCAL_REPOSITORY ?:
'/home/jenkins/jenkins-slave/maven-repositories/0'
def AGENT_LABEL = env.AGENT_LABEL ?: 'power-for-camel'
-def JDK_NAME = env.JDK_NAME ?: 'jdk_21_latest'
+def JDK_NAME = env.JDK_NAME ?: 'jdk_17_latest'
def MAVEN_PARAMS = '-U -B -e -fae -V
-Dmaven.repo.local=/home/jenkins/.m2/repository -Dmaven.compiler.fork=true'
diff --git
a/core/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/CamelVirtualThreadsTest.java
b/core/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/CamelVirtualThreadsTest.java
index d0f1ec52db2..7ceb9c480c9 100644
---
a/core/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/CamelVirtualThreadsTest.java
+++
b/core/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/CamelVirtualThreadsTest.java
@@ -16,6 +16,7 @@
*/
package org.apache.camel.spring.boot;
+import java.lang.reflect.Method;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
@@ -25,6 +26,8 @@ import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.test.spring.junit6.CamelSpringBootTest;
import org.awaitility.Awaitility;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.EnabledForJreRange;
+import org.junit.jupiter.api.condition.JRE;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
@@ -60,8 +63,8 @@ public class CamelVirtualThreadsTest {
// Capture the current thread information
Thread currentThread = Thread.currentThread();
String threadName = currentThread.getName();
- boolean isVirtual = currentThread.isVirtual();
-
+ boolean isVirtual = isVirtualThread(currentThread);
+
// Store thread information in exchange properties
for assertion
exchange.setProperty("threadName", threadName);
exchange.setProperty("isVirtual", isVirtual);
@@ -73,6 +76,15 @@ public class CamelVirtualThreadsTest {
}
}
+ private static boolean isVirtualThread(Thread thread) {
+ try {
+ Method isVirtual = Thread.class.getMethod("isVirtual");
+ return (boolean) isVirtual.invoke(thread);
+ } catch (Exception e) {
+ return false;
+ }
+ }
+
@Test
public void testCamelVirtualThreadPropertyIsSet() throws Exception {
// Verify that the environment post processor set the
camel.threads.virtual.enabled property
@@ -83,6 +95,7 @@ public class CamelVirtualThreadsTest {
}
@Test
+ @EnabledForJreRange(min = JRE.JAVA_21)
public void testRouteExecutesOnVirtualThread() throws Exception {
CountDownLatch latch = new CountDownLatch(1);
AtomicReference<Boolean> isVirtualThread = new
AtomicReference<>(false);
@@ -96,7 +109,7 @@ public class CamelVirtualThreadsTest {
.routeId("virtualTestRoute")
.process(exchange -> {
Thread currentThread = Thread.currentThread();
- isVirtualThread.set(currentThread.isVirtual());
+ isVirtualThread.set(isVirtualThread(currentThread));
threadName.set(currentThread.getName());
latch.countDown();
});
diff --git a/pom.xml b/pom.xml
index 2b1660984ed..74e9791789f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -104,7 +104,7 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<site-repo-url>scpexe://people.apache.org/www/camel.apache.org/maven/</site-repo-url>
- <jdk.version>21</jdk.version>
+ <jdk.version>17</jdk.version>
<!-- These two are here only to prevent the versions for the Apache
parent pom from leaking-->
<maven.compiler.source>${jdk.version}</maven.compiler.source>
<maven.compiler.target>${jdk.version}</maven.compiler.target>
@@ -178,7 +178,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
- <source>21</source>
+ <source>17</source>
<additionalOptions>${javadoc.opts}</additionalOptions>
<doclint>none</doclint>
</configuration>
@@ -676,7 +676,7 @@
<goal>jar</goal>
</goals>
<configuration>
- <source>21</source>
+ <source>17</source>
<doclint>none</doclint>
</configuration>
</execution>