Skip to content

TEDEFO-5290 Build and target Java 21 instead of Java 11 - #8

Draft
amiliosc wants to merge 2 commits into
developfrom
TEDEFO-5290-java-21
Draft

amiliosc wants to merge 2 commits into
developfrom
TEDEFO-5290-java-21

Conversation

@amiliosc

@amiliosc amiliosc commented Oct 21, 2026 •

Copy link
Copy Markdown

Merge prerequisites — on hold

Keep this PR in draft while MDM is not ready for Java 21. This is the agreed hold for the coordinated migration.

  • MDM readiness: TEDEFO-5065 — MDM migrate to Java 21. No MDM Java 21 migration MR was found as of 26 October 2026. Add its link here when opened and verify build, CI and runtime readiness before lifting the hold. MDM !1406 is already merged, but was only the preparatory step retaining Java 11.
  • Upstream PR(s): Merge Notice Viewer #127 first, following EXT #185 and ECL #74. Confirm Viewer 0.14.0-SNAPSHOT is published, update the CLI's Viewer pin, and verify the packaged CLI including visualise. SDK Analyzer is not a prerequisite for CLI.

MDM currently targets Java 11 and already consumes EXT 2.0.0-SNAPSHOT, Analyzer 1.16.0-SNAPSHOT and Notice Viewer 0.14.0-SNAPSHOT. Avoid publishing Java 21 replacements for those active coordinates before MDM is ready. ECL uses the new 2.0.0-SNAPSHOT coordinate; holding ECL too is part of the agreed rollout sequence.

After the hold is lifted: ECL → EXT → Analyzer and Notice Viewer (either order) → CLI after Notice Viewer. Wait for successful upstream snapshot publication and downstream verification between dependent merges.


Jira: TEDEFO-5290

Completes the proposed Java 21 series for ECL (TEDEFO-5287), EXT (TEDEFO-5288) and ENV (TEDEFO-5289); their prerequisite PRs are linked above. The CLI was the last piece of the EFX Toolkit family still on Java 11, while its own main dependency efx-toolkit-java 2.0.0-SNAPSHOT already builds at release 21.

Changes

  • pom.xml: replace maven.compiler.source / maven.compiler.target (11) with maven.compiler.release (21). Unlike source/target, release also checks that no API newer than the target is referenced, so a Java 21 method cannot silently leak into a build claiming an older target. It is also the property name already used by efx-toolkit-java, so the two poms stay consistent.
  • README.md: the requirements section now states Java 21 or later.

No source changes were needed: all 22 main sources and 2 test sources compile unchanged. maven-compiler-plugin was already pinned (3.13.0), and this repository has no CI workflows, so the scope is narrower than TEDEFO-5288.

Tested

  • mvn clean package passes on Temurin 21.0.12.1 with Maven 3.8.8, the compiler reporting release 21 for both source sets, no warnings.
  • The shaded uber-jar builds and runs: --version and --help both work, and all six commands are present (translate-rules, validate, visualise, extract-dependencies, config, clear).
  • Emitted bytecode confirmed at class-file major version 65.
  • Test suite: 11 tests, 7 pass, 4 fail.

Pre-existing test failures, not caused by this change

All 4 failures are ValidateCommandTest.testFullPipeline and share one root cause: the test requests eForms SDK 2.0.0-SNAPSHOT at sdk-path=eforms-sdk, which is neither resolvable from the repository nor present on disk. The run reports SDK download failed (No artifacts found for SDK 2.0.0-SNAPSHOT.) followed by Failed to instantiate Symbol Resolver, so EFX translation never happens.

Re-running the same suite with -Dmaven.compiler.release=11 reproduces the identical 4 failures in the identical scenarios, which confirms they predate this change.

The 7 passing tests do cover the runtime stack on Java 21: ValidateCommandTest.testValidation uses --schematron to bypass EFX translation, needs no SDK, and passes in both schxslt and phpure modes, exercising Saxon-HE 11.3, SchXSLT and ph-schematron-pure end to end.

Notes for the reviewer

  • Breaking change, but milder than for ECL and EXT: the CLI ships as an executable shaded uber-jar rather than a consumed library, so the impact lands on the JRE users launch it with, not on a downstream compile-time dependency chain.
  • The visualise path (freemarker, JCS cache) has no test coverage, so it is verified as compiling only, not as running on 21.
  • CHANGELOG.md is deliberately untouched here: it currently documents only 0.1.0, so the new runtime requirement belongs in the 0.2.0 release notes.
  • Out of scope: adding maven-enforcer-plugin requireJavaVersion [21,) so a developer on an older JDK gets a clear message instead of invalid target release: 21; and the README usage examples still referencing efx-cli-0.1.0.jar while the pom is at 0.2.0-SNAPSHOT.

@amiliosc
amiliosc requested a review from rousso October 21, 2026 07:24

rousso commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

The Java 21 compiler change looks sound. Please keep the CLI at 0.2.0-SNAPSHOT and complete the following adjustments for the coordinated migration:

  1. Align the Notice Viewer dependency. The CLI currently pins eforms-notice-viewer:0.13.0-SNAPSHOT, while TEDEFO-5289: Build and target Java 21 instead of Java 11 eforms-notice-viewer#127 targets 0.14.0-SNAPSHOT. Once that aligned snapshot is available, update the CLI dependency to 0.14.0-SNAPSHOT so the packaged CLI includes the Viewer migration. Consuming the older Java 11 Viewer on Java 21 is not itself a bytecode error; this adjustment is needed to include the intended migration across the dependency chain.

  2. Keep the core dependency consistent across EXT and Viewer. Retain the CLI's efx-toolkit-java:2.0.0-SNAPSHOT dependency. Coordinate with TEDEFO-5288: Build and target Java 21 instead of Java 11 efx-toolkit-java#185 and TEDEFO-5289: Build and target Java 21 instead of Java 11 eforms-notice-viewer#127 so both use ECL 2.0.0-SNAPSHOT, following TEDEFO-5287 Build and target Java 21 instead of Java 11 eforms-core-java#74. The Viewer PR still pins ECL 1.10.0-SNAPSHOT. The CLI already obtains ECL transitively through EXT; adding a direct ECL dependency here is unnecessary. Check the resolved dependency tree after alignment.

  3. Record the runtime boundary and reconcile installation instructions. State in the README and the 0.2.0 changelog/release notes that “EFX CLI 0.2.0 and later require Java 21 or later.” The open installation-guide PR Added INSTALLATION.md #7 currently says JDK 17+ in both its prerequisites and version-check example; coordinate an update to Java 21 so the merged instructions agree.

  4. Rerun verification with the final dependency set and smoke-test visualisation. Run mvn clean verify, check the shaded JAR's --help and --version, and run visualise with a known notice/SDK to verify the Viewer path on Java 21. Record the exact dependency versions and results in this PR. Also revise the description's “already done” wording: the related ECL, EXT and Viewer Java 21 PRs are still open.

Review evidence at head d97ac52: the CLI compiled at release 21 and mvn verify passed all 11 tests, including all four full-pipeline cases, against locally built Java 21 ECL 2 and EXT 2 aligned to it. Shaded-JAR packaging, --help and --version also passed. No CLI source edits were needed. This run retained the CLI's existing Viewer 0.13.0-SNAPSHOT; it does not validate Viewer PR #127 or the visualise command. The four failures described in the PR were therefore not reproduced in this environment; please rerun and update the test section rather than treating them as an unavoidable baseline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants