You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by fm...@apache.org on 2026/04/16 12:55:33 UTC
(camel) branch main updated: Enforce JDK 21+ as minimum build JDK for multi-release JAR support (#22608)
This is an automated email from the ASF dual-hosted git repository.
fmariani pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 3703beeb7b1f Enforce JDK 21+ as minimum build JDK for multi-release JAR support (#22608)
3703beeb7b1f is described below
commit 3703beeb7b1f220c624db073497d35bb96093689
Author: Federico Mariani <34...@users.noreply.github.com>
AuthorDate: Thu Apr 16 14:55:27 2026 +0200
Enforce JDK 21+ as minimum build JDK for multi-release JAR support (#22608)
* Enforce JDK 21+ as minimum build JDK for multi-release JAR support
* Enforce JDK 25+ for release builds to compile all multi-release JAR layers
---------
---
.github/workflows/pr-build-main.yml | 6 ++++++
etc/scripts/regen.sh | 4 ++--
pom.xml | 25 +++++++++++++++++++++++++
3 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/pr-build-main.yml b/.github/workflows/pr-build-main.yml
index 2fc511afe40a..95b0e8475990 100644
--- a/.github/workflows/pr-build-main.yml
+++ b/.github/workflows/pr-build-main.yml
@@ -70,6 +70,10 @@ jobs:
java: ['17', '21']
experimental: [ false ]
include:
+ - java: '17'
+ # JDK 17 is kept for runtime compatibility testing.
+ # Skip the enforcer which requires JDK 21+ (needed to compile JDK 21-specific classes).
+ maven_extra_args: '-Denforcer.phase=none'
- java: '25'
experimental: true
@@ -90,6 +94,8 @@ jobs:
cache: 'maven'
- name: maven build
if: ${{ !inputs.skip_full_build }}
+ env:
+ MAVEN_EXTRA_ARGS: ${{ matrix.maven_extra_args || '' }}
run: ./etc/scripts/regen.sh
- name: Quick dependency build
if: ${{ inputs.skip_full_build }}
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 9dfb391d5828..379e950d2d86 100644
--- a/pom.xml
+++ b/pom.xml
@@ -195,6 +195,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. JDK 21-specific classes (e.g., virtual thread support in camel-util) are only compiled with JDK 21+. Building with JDK 17 silently omits these classes from the resulting JARs.</message>
+ </requireJavaVersion>
+ </rules>
+ </configuration>
</execution>
</executions>
</plugin>
@@ -861,6 +869,23 @@
<outputName>${project.artifactId}-${project.version}-sbom</outputName>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>enforce-java-version</id>
+ <configuration>
+ <rules>
+ <requireJavaVersion>
+ <version>[25,)</version>
+ <message>JDK 25+ is required for releases to ensure all multi-release JAR layers (java-21, java-25) are compiled.</message>
+ </requireJavaVersion>
+ </rules>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>