Repository navigation
Conversation
…I artifacts (apache#14163) Introduces JakartaEeApiMigrationStrategy, a new mvnup upgrade strategy that detects and migrates legacy Java EE API Maven dependencies to their Jakarta EE equivalents. Java 11 (JEP 320) removed several Java EE modules from the JDK that were previously bundled in rt.jar: JAXB (javax.xml.bind), JAX-WS (javax.xml.ws), javax.annotation, javax.activation, and javax.jws. Projects that declared these APIs as explicit Maven dependencies (javax.xml.bind:jaxb-api, etc.) will fail to compile on JDK 11+ until they migrate to the standalone Jakarta EE equivalents. This strategy: - Scans <dependencies>, <dependencyManagement>, profile dependencies, and plugin-level dependencies for the known legacy Java EE artifact coordinates - Replaces matched entries with the last Jakarta EE release that preserves the javax.* package namespace (source-compatible, no import changes required) - Updates the version element in-place when explicitly declared; leaves it untouched when version is managed via dependencyManagement Migration table (legacy → Jakarta EE replacement): javax.xml.bind:jaxb-api → jakarta.xml.bind:jakarta.xml.bind-api:2.3.3 com.sun.xml.bind:jaxb-core → org.glassfish.jaxb:jaxb-core:2.3.0.1 com.sun.xml.bind:jaxb-impl → org.glassfish.jaxb:jaxb-runtime:2.3.9 javax.xml.ws:jaxws-api → jakarta.xml.ws:jakarta.xml.ws-api:2.3.3 javax.jws:javax.jws-api → jakarta.jws:jakarta.jws-api:1.1.1 javax.annotation:javax.annotation-api → jakarta.annotation:jakarta.annotation-api:1.3.5 javax.activation:activation → jakarta.activation:jakarta.activation-api:1.2.2 javax.activation:javax.activation-api → jakarta.activation:jakarta.activation-api:1.2.2 Note: this covers the case where projects explicitly declare these artifacts. Projects relying purely on rt.jar without declaring the dependency will still need manual intervention (toolchain injection or explicit dep addition). Fixes apache#14163
|
I'm not sure if this is really a task of the mvnup tool. edit: and changing the deps is not enough. The imports in Java code needs to be changed, config files need to be changed as well due the namespace change. |
gnodet-bot
left a comment
There was a problem hiding this comment.
Well-structured new strategy that correctly follows the existing mvnup pattern (e.g. NashornCompatibilityStrategy). Two real issues to address before merge.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
|
Just to clarify on the package concern: the replacements in this PR target the last Jakarta EE
No import changes are needed — these are drop-in replacements at the Maven coordinate level only. The I'm open to dropping this PR if the scope is considered too broad for |
- Detect property expressions (${...}) in version elements and warn
instead of silently replacing them with literal versions
- Change post-migration context.warning() to context.detail() since
the migration is already complete and not actionable
- Add test for property expression version preservation
- Add test for plugin-level dependency migration
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gnodet-bot
left a comment
There was a problem hiding this comment.
Following up on my earlier review — all 3 findings have been addressed. ✅
[Medium] Property expression version clobbering — ✅ Fixed. The ${...} detection is correct: groupId and artifactId are still migrated (the coordinate change is unambiguous), while the version element is preserved and a context.warning() is emitted with the target version for the user to update manually. This is the right behaviour.
[Low] context.warning() after completed migration — ✅ Fixed. Post-migration logging now uses context.detail(). The context.warning() call that remains is for the property-expression case (actionable by the user), which is appropriate.
[Low] No plugin-level dependency test — ✅ Fixed. PluginDependencyTests added with a test covering <build><plugins><plugin><dependencies> migration.
One minor observation on the property-expression test: preservesPropertyExpressionVersion verifies the XML output (property preserved, no literal version injected) but does not assert that context.warning() was actually called. The mock context would need a verifyWarningContains(...) check to close that gap — currently the warning behaviour is exercised but not asserted. Low severity, not a blocker.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
Summary
Introduces
JakartaEeApiMigrationStrategy, a newmvnupupgrade strategy thatdetects and migrates legacy Java EE API Maven dependencies to their Jakarta EE
equivalents.
Root Cause
Java 11 (JEP 320) removed several Java EE modules from the JDK that were
previously bundled in
rt.jar: JAXB (javax.xml.bind), JAX-WS (javax.xml.ws),javax.annotation,javax.activation, andjavax.jws. Projects that declaredthese APIs as explicit Maven dependencies (e.g.
javax.xml.bind:jaxb-api) willfail to compile on JDK 11+ unless they migrate to the standalone Jakarta EE
equivalents.
mvnuppreviously had no handling for these JEP 320 removed APIs. The existingToolchainPluginStrategyonly acts on JEP 182 retired source levels (≤7) anddoes not detect JEP 320-removed API usage even when
source=8is declared.Fix
The new
JakartaEeApiMigrationStrategy(priority 16, runs alongsideToolchainPluginStrategy) scans all dependency sections in each POM file:<dependencies><dependencyManagement><dependencies><dependencies>and<dependencyManagement><dependencies>(e.g.maven-antrun-plugin)When a legacy Java EE artifact is found, it is replaced in-place with the
last Jakarta EE release that preserves the
javax.*package namespace — makingit source-compatible without requiring import changes:
javax.xml.bind:jaxb-apijakarta.xml.bind:jakarta.xml.bind-api:2.3.3com.sun.xml.bind:jaxb-coreorg.glassfish.jaxb:jaxb-core:2.3.0.1com.sun.xml.bind:jaxb-implorg.glassfish.jaxb:jaxb-runtime:2.3.9javax.xml.ws:jaxws-apijakarta.xml.ws:jakarta.xml.ws-api:2.3.3javax.jws:javax.jws-apijakarta.jws:jakarta.jws-api:1.1.1javax.annotation:javax.annotation-apijakarta.annotation:jakarta.annotation-api:1.3.5javax.activation:activationjakarta.activation:jakarta.activation-api:1.2.2javax.activation:javax.activation-apijakarta.activation:jakarta.activation-api:1.2.2The version element is updated only when it is explicitly declared on the
dependency. Versions managed via
<dependencyManagement>(absent at the usagesite) are left untouched.
Tests
JakartaEeApiMigrationStrategyTest(18 test cases) covers:--model,--all, default)jaxb-api,jaxws-api,javax.annotation-api,activation)<dependencyManagement>migration<dependencies>migrationRelates to / partially addresses #14163.
Note: this covers the case where projects explicitly declare the removed Java EE artifacts. Projects relying purely on
rt.jarwithout any POM declaration cannot be detected from the POM alone and are out of scope for this strategy.Hermes Agent (Claude Sonnet 4.5) on behalf of Guillaume Nodet