[ 
https://issues.apache.org/jira/browse/CAMEL-22996?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Aurélien Pupier updated CAMEL-22996:
------------------------------------
    Description: 
As part of the big work leading up to SB4 and what else, then its worth to 
consider dropping Java 17 and let 21 be primary supported and also the minimum 
version.

There is no bandwidth to support 17, 21, and 25. Camel only officially support 
at most 2 LTS java versions.

To reopen when upgraded https://github.com/apache/camel/pull/24299

h2. Plan: Drop Java 17 — Make Java 21 the Minimum Version

The build already requires JDK 21+ (enforcer rule in root pom.xml), so this is 
a compile-target + runtime change. Six areas need updating.

h3. Sub-Task 1 — Raise jdk.version in the root POM

Changing the single jdk.version property propagates maven.compiler.source, 
maven.compiler.target, maven.compiler.release, minimalJavaBuildVersion, and 
sonar.java.source to every module.

In pom.xml line 113, change <jdk.version>17</jdk.version> → 
<jdk.version>21</jdk.version>
Note: the enforcer requireJavaVersion already says [21,) — no change needed 
there.

h3. Sub-Task 2 — Update archetype template POMs

Archetypes still hard-code <release>17</release> and would generate Java-17 
user projects.

archetypes/camel-archetype-main/src/main/resources/archetype-resources/pom.xml 
— change 17 → 21
archetypes/camel-archetype-java/src/main/resources/archetype-resources/pom.xml 
— change 17 → 21
archetypes/camel-archetype-dataformat/src/main/resources/archetype-resources/pom.xml
 — change 17 → 21
archetypes/camel-archetype-component/src/main/resources/archetype-resources/pom.xml
 — change 17 → 21
archetypes/camel-archetype-api-component/src/main/resources/archetype-resources/__artifactId__-component/pom.xml
 — change 17 → 21
archetypes/camel-archetype-api-component/src/main/resources/archetype-resources/pom.xml
 — change 17 → 21
h3. Sub-Task 3 — Remove Java 17 from GitHub Actions CI matrix

The PR build matrix tests ['17', '25'], keeping JDK 17 "for runtime 
compatibility testing". Once 21 is the minimum that row is redundant.

File: .github/workflows/pr-build-main.yml

Remove '17' from the java: matrix list
Remove the include: block that injects -Denforcer.phase=none for Java 17
Add '21' to the matrix so the new minimum is covered (result: ['21', '25'])
Note: .github/workflows/main-build.yml builds only with Java 25 — no change 
needed.

h3. Sub-Task 4 — Remove Java 17 from the Jenkins pipeline

File: Jenkinsfile

Remove def MAVEN_JDK_17_PARAMS = "-Denforcer.skip=true" (line 20)
Remove 'jdk_17_latest' from the JDK_FILTER parameter choices (line 55)
Remove 'jdk_17_latest' from the JDK_NAME axis values (line 80)
Remove the two exclude blocks that pair jdk_17_latest with ppc64le and s390x 
(lines 88–107)
Remove the else if ("${JDK_NAME}" == "jdk_17_latest") build branch (lines 
168–170)
h3. Sub-Task 5 — Resolve "TODO Update once baseline is Java 21" code comments

11 locations deferred API modernisation behind that comment. The changes are:

Replace Thread.getId() with Thread.threadId() (deprecated since Java 19):

core/camel-management/.../ManagedAsyncProcessorAwaitManager.java line 85
core/camel-base-engine/.../DefaultAsyncProcessorAwaitManager.java line 262
components/camel-google/camel-google-pubsub/.../GooglePubsubProducer.java line 
65
components/camel-google/camel-google-bigquery/.../GoogleBigQueryProducer.java 
line 175
components/camel-as2/.../AS2ServerConnection.java line 493
components/camel-as2/.../AS2AsyncMDNServerConnection.java line 198
components/camel-smpp/.../SmppProducer.java lines 96, 175, 226
components/camel-smpp/.../SmppConsumer.java line 201
Replace new Locale(...) constructor with Locale.of(...) factory method 
(available since Java 19):

components/camel-bindy/.../FormattingOptions.java line 126
h3. Sub-Task 6 — Update user-facing documentation

Historical upgrade guides that mention Java 17 in the context of past releases 
must not be changed — only forward-looking pages.

docs/user-manual/modules/ROOT/pages/what-are-the-dependencies.adoc — add a new 
JDK support row: Camel 4.24.0+ requires JDK 21
docs/user-manual/modules/ROOT/pages/camel-jbang-getting-started.adoc line 7 — 
replace "Java 17 or later" with "Java 21 or later"
docs/user-manual/modules/ROOT/pages/camel-jbang-launcher-install.adoc lines 25 
& 47 — replace "Java 17+" with "Java 21+"
Create/update 
docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc — add a 
"Java" section noting the new minimum requirement
Add the xref link for 4.24 in 
docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide.adoc if not already 
present
h3. Out of scope

Enabling virtual threads by default (separate decision)
Promoting the Java-21 multi-release CamelThreadFactory to the main source tree 
(the multi-release JAR already picks it up at runtime; can be a follow-up)
Any Java 25-specific work

h2. Dependency Diagram

```
Sub-Task 1 (root POM jdk.version)
    └─ Sub-Task 2 (archetype POMs)        [independent, can run in parallel]
    └─ Sub-Task 3 (GitHub Actions)        [independent]
    └─ Sub-Task 4 (Jenkinsfile)           [independent]
    └─ Sub-Task 5 (TODO modernisations)   [independent]
    └─ Sub-Task 6 (documentation)         [independent]
```

All sub-tasks are logically independent once Sub-Task 1 establishes the intent, 
but they can be
committed separately or together. I think there should be separated commit for 
each-subtask but provided in a single PR


  was:
As part of the big work leading up to SB4 and what else, then its worth to 
consider dropping Java 17 and let 21 be primary supported and also the minimum 
version.

There is no bandwidth to support 17, 21, and 25. Camel only officially support 
at most 2 LTS java versions.

To reopen when upgraded https://github.com/apache/camel/pull/24299

# Plan: Drop Java 17 — Make Java 21 the Minimum Version (CAMEL-22996)

## Top-Level Overview

The goal is to raise the minimum supported Java version from 17 to 21.
The build already **requires** JDK 21+ (enforcer rule on line 201 of 
`pom.xml`), so this is purely
a runtime/compile-target change: the bytecode produced, the CI matrix, the 
archetype templates,
the inline TODO modernisations, and the user-facing documentation all need to 
reflect Java 21 as
the new floor.

**Out of scope for this plan:**
- Enabling virtual threads by default (separate decision/issue).
- Promoting the Java-21 multi-release `CamelThreadFactory` to the main source 
tree (can be a
  follow-up; the multi-release JAR already picks it up at runtime on JDK 21+).
- Any Java 25-specific work.

---

## Sub-Tasks

---

### Sub-Task 1 — Raise `jdk.version` in the root POM

**Status:** [ ] pending

**Intent:**  
Changing the single `jdk.version` property propagates the compile target, 
source level, release
flag, `minimalJavaBuildVersion`, and Sonar `sonar.java.source` to every module 
automatically.

**Expected Outcomes:**
- `pom.xml` property `jdk.version` reads `21`.
- All downstream references (`maven.compiler.source`, `maven.compiler.target`,
  `maven.compiler.release`, `minimalJavaBuildVersion`, `sonar.java.source`) 
resolve to `21`.

**Todo List:**
1. In `pom.xml` line 113, change `<jdk.version>17</jdk.version>` to 
`<jdk.version>21</jdk.version>`.

**Relevant Context:**
- `pom.xml` lines 113–123: the property block.
- The enforcer's `requireJavaVersion` rule (lines 196–206) already says `[21,)` 
— no change needed.

---

### Sub-Task 2 — Update archetype template POMs

**Status:** [ ] pending

**Intent:**  
Archetypes generate user projects. Their embedded POMs still hard-code 
`<release>17</release>`,
which would give new users a Java-17 project even after the framework baseline 
is raised.

**Expected Outcomes:**
- Every archetype resource `pom.xml` uses `<release>21</release>`.

**Todo List:**
1. 
`archetypes/camel-archetype-main/src/main/resources/archetype-resources/pom.xml`
 line 107 — change `17` → `21`.
2. 
`archetypes/camel-archetype-java/src/main/resources/archetype-resources/pom.xml`
 line 91 — change `17` → `21`.
3. 
`archetypes/camel-archetype-dataformat/src/main/resources/archetype-resources/pom.xml`
 line 86 — change `17` → `21`.
4. 
`archetypes/camel-archetype-component/src/main/resources/archetype-resources/pom.xml`
 line 87 — change `17` → `21`.
5. 
`archetypes/camel-archetype-api-component/src/main/resources/archetype-resources/__artifactId__-component/pom.xml`
 line 94 — change `17` → `21`.
6. 
`archetypes/camel-archetype-api-component/src/main/resources/archetype-resources/pom.xml`
 line 59 — change `17` → `21`.

**Relevant Context:**
- All files live under `archetypes/`.

---

### Sub-Task 3 — Remove Java 17 from GitHub Actions CI matrix

**Status:** [ ] pending

**Intent:**  
The PR build matrix tests with `['17', '25']`, keeping JDK 17 "for runtime 
compatibility testing".
Once 21 is the minimum, that row is no longer relevant and only wastes CI time.

**Expected Outcomes:**
- `.github/workflows/pr-build-main.yml` no longer lists `'17'` in the matrix.
- The `maven_extra_args: '-Denforcer.phase=none'` override for Java 17 is 
removed.
- The matrix contains `['21', '25']` (or just `['25']` if the project decides 
one JDK is enough — confirm with committers).

**Todo List:**
1. Open `.github/workflows/pr-build-main.yml`.
2. Remove `'17'` from the `java:` matrix list (line 74).
3. Remove the `include:` block that injects `-Denforcer.phase=none` for Java 17 
(lines 76–80).
4. Add `'21'` to the matrix if not already present (so we test on the new 
minimum).

**Relevant Context:**
- `.github/workflows/pr-build-main.yml` lines 73–81.
- `.github/workflows/main-build.yml` currently only builds with Java 25 — no 
change needed.

---

### Sub-Task 4 — Remove Java 17 from the Jenkins pipeline

**Status:** [ ] pending

**Intent:**  
The `Jenkinsfile` defines a build matrix with `jdk_17_latest`, `jdk_21_latest`, 
`jdk_25_latest`
and special logic to skip the enforcer for JDK 17. Removing JDK 17 simplifies 
the pipeline and
eliminates the workaround variable `MAVEN_JDK_17_PARAMS`.

**Expected Outcomes:**
- `Jenkinsfile` no longer references `jdk_17_latest`.
- `MAVEN_JDK_17_PARAMS` variable and its usage are removed.
- The JDK filter parameter default choices no longer include `jdk_17_latest`.
- The `else if ("${JDK_NAME}" == "jdk_17_latest")` branch in the build stage is 
removed.
- Exclude rules that referenced `jdk_17_latest` are removed.

**Todo List:**
1. Remove `def MAVEN_JDK_17_PARAMS = "-Denforcer.skip=true"` (line 20).
2. Remove `'jdk_17_latest'` from the `JDK_FILTER` parameter choices (line 55).
3. Remove `'jdk_17_latest'` from the `JDK_NAME` axis values (line 80).
4. Remove the two `exclude` blocks that reference `jdk_17_latest` (lines 
88–107).
5. Remove the `else if ("${JDK_NAME}" == "jdk_17_latest")` branch (lines 
168–170).

**Relevant Context:**
- `Jenkinsfile` lines 20, 55, 79–107, 168–170.

---

### Sub-Task 5 — Resolve "TODO Update once baseline is Java 21" code comments

**Status:** [ ] pending

**Intent:**  
11 locations across the codebase deferred API modernisation behind a "TODO: 
update once baseline
is Java 21" comment. Now is the time to make those updates.

**Expected Outcomes:**
- All `Thread.getId()` calls replaced with `Thread.threadId()`.
- `new Locale(...)` constructor replaced with `Locale.of(...)` factory method.
- All TODO comments removed.

**Todo List:**
1. 
`core/camel-management/src/main/java/org/apache/camel/management/mbean/ManagedAsyncProcessorAwaitManager.java`
 line 85 — replace `thread.getId()` with `thread.threadId()`.
2. 
`core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultAsyncProcessorAwaitManager.java`
 line 262 — replace `thread.getId()` with `thread.threadId()`.
3. 
`components/camel-google/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubProducer.java`
 line 65 — replace `.getId()` with `.threadId()`.
4. 
`components/camel-google/camel-google-bigquery/src/main/java/org/apache/camel/component/google/bigquery/GoogleBigQueryProducer.java`
 line 175 — replace `.getId()` with `.threadId()`.
5. 
`components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2ServerConnection.java`
 line 493 — replace `.getId()` with `.threadId()`.
6. 
`components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2AsyncMDNServerConnection.java`
 line 198 — replace `.getId()` with `.threadId()`.
7. 
`components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppProducer.java`
 lines 96, 175, 226 — replace `.getId()` with `.threadId()`.
8. 
`components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppConsumer.java`
 line 201 — replace `.getId()` with `.threadId()`.
9. 
`components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/FormattingOptions.java`
 line 126 — replace `new Locale(result[0])` with `Locale.of(result[0])`.

**Relevant Context:**
- `Thread.getId()` was deprecated in Java 19 and the recommended replacement 
`Thread.threadId()` is available since Java 19 (GA in 21).
- `Locale.of()` factory method is available since Java 19 (GA in 21).

---

### Sub-Task 6 — Update user-facing documentation

**Status:** [ ] pending

**Intent:**  
Several documentation pages still state "Java 17" as the minimum. They must 
reflect Java 21.
Historical upgrade guides that mention Java 17 in the context of *past* 
releases should be left
unchanged (they describe the state as of that release).

**Expected Outcomes:**
- `docs/user-manual/modules/ROOT/pages/what-are-the-dependencies.adoc` updated: 
JDK support row for the current Camel 4 series reads "requires JDK 21".
- `docs/user-manual/modules/ROOT/pages/camel-jbang-getting-started.adoc` line 7 
updated from "Java 17 or later" to "Java 21 or later".
- `docs/user-manual/modules/ROOT/pages/camel-jbang-launcher-install.adoc` lines 
25 and 47 updated from "Java 17+" to "Java 21+".
- An entry is added to the current cycle upgrade guide 
(`camel-4x-upgrade-guide-4_24.adoc`) noting the Java 21 minimum requirement.
- The new entry is also linked from `camel-4x-upgrade-guide.adoc`.

**Todo List:**
1. Edit `what-are-the-dependencies.adoc`: add a new line `Camel 4.24.0+ 
requires JDK 21` (or update the existing Camel 4 line to reflect the version 
where the change lands).
2. Edit `camel-jbang-getting-started.adoc` line 7: replace `Java 17 or later` 
with `Java 21 or later`.
3. Edit `camel-jbang-launcher-install.adoc`: replace the two `Java 17+` 
references with `Java 21+`.
4. Create (or update) 
`docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc` with a 
"Java" section documenting the new minimum.
5. If the upgrade guide for 4.24 is new, add its `xref:` link in 
`camel-4x-upgrade-guide.adoc`.

**Relevant Context:**
- Current version is `4.24.0-SNAPSHOT` (root `pom.xml`).
- Upgrade guide format follows the pattern in 
`camel-4x-upgrade-guide-4_23.adoc`.
- Historical mentions of "Java 17" in past upgrade guides (e.g. 4.22, 4.15, 
4.14) describe the state at those releases and should **not** be changed.

---

## Dependency Diagram

```
Sub-Task 1 (root POM jdk.version)
    └─ Sub-Task 2 (archetype POMs)        [independent, can run in parallel]
    └─ Sub-Task 3 (GitHub Actions)        [independent]
    └─ Sub-Task 4 (Jenkinsfile)           [independent]
    └─ Sub-Task 5 (TODO modernisations)   [independent]
    └─ Sub-Task 6 (documentation)         [independent]
```

All sub-tasks are logically independent once Sub-Task 1 establishes the intent, 
but they can be
committed separately or together. I think there should be separated commit for 
each-subtask but provided in a single PR



> Drop Java 17 so Java 21 is minimum and primary supported
> --------------------------------------------------------
>
>                 Key: CAMEL-22996
>                 URL: https://issues.apache.org/jira/browse/CAMEL-22996
>             Project: Camel
>          Issue Type: Task
>          Components: build system
>            Reporter: Claus Ibsen
>            Assignee: Aurélien Pupier
>            Priority: Major
>             Fix For: 4.24.0
>
>
> As part of the big work leading up to SB4 and what else, then its worth to 
> consider dropping Java 17 and let 21 be primary supported and also the 
> minimum version.
> There is no bandwidth to support 17, 21, and 25. Camel only officially 
> support at most 2 LTS java versions.
> To reopen when upgraded https://github.com/apache/camel/pull/24299
> h2. Plan: Drop Java 17 — Make Java 21 the Minimum Version
> The build already requires JDK 21+ (enforcer rule in root pom.xml), so this 
> is a compile-target + runtime change. Six areas need updating.
> h3. Sub-Task 1 — Raise jdk.version in the root POM
> Changing the single jdk.version property propagates maven.compiler.source, 
> maven.compiler.target, maven.compiler.release, minimalJavaBuildVersion, and 
> sonar.java.source to every module.
> In pom.xml line 113, change <jdk.version>17</jdk.version> → 
> <jdk.version>21</jdk.version>
> Note: the enforcer requireJavaVersion already says [21,) — no change needed 
> there.
> h3. Sub-Task 2 — Update archetype template POMs
> Archetypes still hard-code <release>17</release> and would generate Java-17 
> user projects.
> archetypes/camel-archetype-main/src/main/resources/archetype-resources/pom.xml
>  — change 17 → 21
> archetypes/camel-archetype-java/src/main/resources/archetype-resources/pom.xml
>  — change 17 → 21
> archetypes/camel-archetype-dataformat/src/main/resources/archetype-resources/pom.xml
>  — change 17 → 21
> archetypes/camel-archetype-component/src/main/resources/archetype-resources/pom.xml
>  — change 17 → 21
> archetypes/camel-archetype-api-component/src/main/resources/archetype-resources/__artifactId__-component/pom.xml
>  — change 17 → 21
> archetypes/camel-archetype-api-component/src/main/resources/archetype-resources/pom.xml
>  — change 17 → 21
> h3. Sub-Task 3 — Remove Java 17 from GitHub Actions CI matrix
> The PR build matrix tests ['17', '25'], keeping JDK 17 "for runtime 
> compatibility testing". Once 21 is the minimum that row is redundant.
> File: .github/workflows/pr-build-main.yml
> Remove '17' from the java: matrix list
> Remove the include: block that injects -Denforcer.phase=none for Java 17
> Add '21' to the matrix so the new minimum is covered (result: ['21', '25'])
> Note: .github/workflows/main-build.yml builds only with Java 25 — no change 
> needed.
> h3. Sub-Task 4 — Remove Java 17 from the Jenkins pipeline
> File: Jenkinsfile
> Remove def MAVEN_JDK_17_PARAMS = "-Denforcer.skip=true" (line 20)
> Remove 'jdk_17_latest' from the JDK_FILTER parameter choices (line 55)
> Remove 'jdk_17_latest' from the JDK_NAME axis values (line 80)
> Remove the two exclude blocks that pair jdk_17_latest with ppc64le and s390x 
> (lines 88–107)
> Remove the else if ("${JDK_NAME}" == "jdk_17_latest") build branch (lines 
> 168–170)
> h3. Sub-Task 5 — Resolve "TODO Update once baseline is Java 21" code comments
> 11 locations deferred API modernisation behind that comment. The changes are:
> Replace Thread.getId() with Thread.threadId() (deprecated since Java 19):
> core/camel-management/.../ManagedAsyncProcessorAwaitManager.java line 85
> core/camel-base-engine/.../DefaultAsyncProcessorAwaitManager.java line 262
> components/camel-google/camel-google-pubsub/.../GooglePubsubProducer.java 
> line 65
> components/camel-google/camel-google-bigquery/.../GoogleBigQueryProducer.java 
> line 175
> components/camel-as2/.../AS2ServerConnection.java line 493
> components/camel-as2/.../AS2AsyncMDNServerConnection.java line 198
> components/camel-smpp/.../SmppProducer.java lines 96, 175, 226
> components/camel-smpp/.../SmppConsumer.java line 201
> Replace new Locale(...) constructor with Locale.of(...) factory method 
> (available since Java 19):
> components/camel-bindy/.../FormattingOptions.java line 126
> h3. Sub-Task 6 — Update user-facing documentation
> Historical upgrade guides that mention Java 17 in the context of past 
> releases must not be changed — only forward-looking pages.
> docs/user-manual/modules/ROOT/pages/what-are-the-dependencies.adoc — add a 
> new JDK support row: Camel 4.24.0+ requires JDK 21
> docs/user-manual/modules/ROOT/pages/camel-jbang-getting-started.adoc line 7 — 
> replace "Java 17 or later" with "Java 21 or later"
> docs/user-manual/modules/ROOT/pages/camel-jbang-launcher-install.adoc lines 
> 25 & 47 — replace "Java 17+" with "Java 21+"
> Create/update 
> docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc — add a 
> "Java" section noting the new minimum requirement
> Add the xref link for 4.24 in 
> docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide.adoc if not 
> already present
> h3. Out of scope
> Enabling virtual threads by default (separate decision)
> Promoting the Java-21 multi-release CamelThreadFactory to the main source 
> tree (the multi-release JAR already picks it up at runtime; can be a 
> follow-up)
> Any Java 25-specific work
> h2. Dependency Diagram
> ```
> Sub-Task 1 (root POM jdk.version)
>     └─ Sub-Task 2 (archetype POMs)        [independent, can run in parallel]
>     └─ Sub-Task 3 (GitHub Actions)        [independent]
>     └─ Sub-Task 4 (Jenkinsfile)           [independent]
>     └─ Sub-Task 5 (TODO modernisations)   [independent]
>     └─ Sub-Task 6 (documentation)         [independent]
> ```
> All sub-tasks are logically independent once Sub-Task 1 establishes the 
> intent, but they can be
> committed separately or together. I think there should be separated commit 
> for each-subtask but provided in a single PR



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to