This is an automated email from the ASF dual-hosted git repository.

fmariani pushed a commit to branch camel-4.18.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-4.18.x by this push:
     new 7912666daebc Enforce JDK 21+ as minimum build JDK for multi-release 
JAR support
7912666daebc is described below

commit 7912666daebc936cdd3d8269055eaf3fcaca881a
Author: Croway <[email protected]>
AuthorDate: Tue Apr 14 13:46:34 2026 +0200

    Enforce JDK 21+ as minimum build JDK for multi-release JAR support
---
 .github/workflows/pr-build-main.yml | 10 +++++++---
 Jenkinsfile.deploy                  |  2 +-
 etc/scripts/regen.sh                |  4 ++--
 pom.xml                             | 10 +++++++++-
 4 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/.github/workflows/pr-build-main.yml 
b/.github/workflows/pr-build-main.yml
index c91680640342..17b1a2636cc1 100644
--- a/.github/workflows/pr-build-main.yml
+++ b/.github/workflows/pr-build-main.yml
@@ -41,11 +41,13 @@ jobs:
     continue-on-error: ${{ matrix.experimental }}
     strategy:
       matrix:
-        java: ['17']
+        java: ['17', '21']
         experimental: [ false ]
         include:
-          - java: '21'
-            experimental: true
+          - java: '17'
+            # JDK 17 is kept for runtime compatibility testing.
+            # Skip the enforcer which requires JDK 21+ (needed for 
multi-release JAR compilation).
+            maven_extra_args: '-Denforcer.phase=none'
 
     steps:
       - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 
v6.0.2
@@ -62,6 +64,8 @@ jobs:
           java-version: ${{ matrix.java }}
           cache: 'maven'
       - name: maven build
+        env:
+          MAVEN_EXTRA_ARGS: ${{ matrix.maven_extra_args || '' }}
         run: ./etc/scripts/regen.sh
       - name: archive logs
         uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f 
# v6.0.0
diff --git a/Jenkinsfile.deploy b/Jenkinsfile.deploy
index a6d1f3152f06..157bebe31d41 100644
--- a/Jenkinsfile.deploy
+++ b/Jenkinsfile.deploy
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 def AGENT_LABEL = env.AGENT_LABEL ?: 'ubuntu'
-def JDK_NAME = env.JDK_NAME ?: 'jdk_17_latest'
+def JDK_NAME = env.JDK_NAME ?: 'jdk_21_latest'
 
 def MAVEN_PARAMS = "-U -B -e -fae -V -Dnoassembly -Dmaven.compiler.fork=true "
 
diff --git a/etc/scripts/regen.sh b/etc/scripts/regen.sh
index 57eb8aab8365..5f4b75f2a69b 100755
--- a/etc/scripts/regen.sh
+++ b/etc/scripts/regen.sh
@@ -26,7 +26,7 @@ git clean -fdx
 rm -Rf **/src/generated/
 
 # Regenerate everything
-if ./mvnw --batch-mode -Pregen -DskipTests install >> build.log 2>&1; then
+if ./mvnw --batch-mode -Pregen -DskipTests ${MAVEN_EXTRA_ARGS} install >> 
build.log 2>&1; then
   echo "✅ mvn -Pregen succeeded."
 else
   echo "❌ mvn -Pregen failed. Last 50 lines of build.log:"
@@ -35,7 +35,7 @@ else
 fi
 
 # One additional pass to get the info for the 'others' jars
-if ./mvnw --batch-mode install -f catalog/camel-catalog >> build.log 2>&1; then
+if ./mvnw --batch-mode ${MAVEN_EXTRA_ARGS} install -f catalog/camel-catalog >> 
build.log 2>&1; then
   echo "✅ mvn install for camel-catalog succeeded."
 else
   echo "❌ mvn install for camel-catalog failed. Last 50 lines of build.log:"
diff --git a/pom.xml b/pom.xml
index ba3eb9a0fde5..e036df811715 100644
--- a/pom.xml
+++ b/pom.xml
@@ -114,7 +114,7 @@
         <maven.compiler.source>${jdk.version}</maven.compiler.source>
         <maven.compiler.target>${jdk.version}</maven.compiler.target>
         <maven.compiler.release>${jdk.version}</maven.compiler.release>
-        <minimalJavaBuildVersion>${jdk.version}</minimalJavaBuildVersion>
+        <minimalJavaBuildVersion>21</minimalJavaBuildVersion>
 
         <!-- reproducible builds: 
https://maven.apache.org/guides/mini/guide-reproducible-builds.html -->
         
<project.build.outputTimestamp>2026-03-23T15:25:22Z</project.build.outputTimestamp>
@@ -190,6 +190,14 @@
                     <execution>
                         <id>enforce-java-version</id>
                         <phase>${enforcer.phase}</phase>
+                        <configuration>
+                            <rules>
+                                <requireJavaVersion>
+                                    <version>[21,)</version>
+                                    <message>JDK 21+ is required to build 
Apache Camel. The multi-release JAR in camel-util requires JDK 21+ to compile 
virtual thread support. Building with JDK 17 produces JARs without virtual 
thread support.</message>
+                                </requireJavaVersion>
+                            </rules>
+                        </configuration>
                     </execution>
                 </executions>
             </plugin>

Reply via email to