Skip to content

[mvnup] Add maven-war-plugin and maven-ear-plugin to plugin upgrade list - #12685

Merged
gnodet merged 1 commit into
apache:maven-4.0.xfrom
gnodet:mvnup-war-ear-plugin
Aug 26, 2026
Merged

[mvnup] Add maven-war-plugin and maven-ear-plugin to plugin upgrade list#12685
gnodet merged 1 commit into
apache:maven-4.0.xfrom
gnodet:mvnup-war-ear-plugin

Conversation

@gnodet

@gnodet gnodet commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add maven-war-plugin (min 3.4.0) to the PLUGIN_UPGRADES list in PluginUpgradeStrategy
  • Add maven-ear-plugin (min 3.4.0) to the PLUGIN_UPGRADES list in PluginUpgradeStrategy

Both plugins use reflection on java.util.Properties internals (via XStream/plexus-archiver) in older versions, which is blocked by the JDK 17+ module system. Since Maven 4 requires JDK 17+, mvnup should upgrade these plugins to compatible versions.

Affected versions

Plugin Broken versions Fix version Root cause
maven-war-plugin < 3.3.2 3.4.0 XStream PropertiesConverter reflects on Properties.defaults field
maven-ear-plugin < 3.3.0 3.4.0 plexus-archiver uses reflection blocked by JDK 17+ modules

Context

Discovered during Maven 4 compatibility testing — projects like mina-vysper using maven-war-plugin:2.1.1 crash with:

java.lang.reflect.InaccessibleObjectException: Unable to make field protected volatile java.util.Properties java.util.Properties.defaults accessible

Running mvnup apply didn't fix this because maven-war-plugin wasn't in the upgrade list.

🤖 Generated with Claude Code

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two issues found — one is a bug:

1. Missing entries in getPluginUpgradesMap() (high severity)

The new maven-war-plugin and maven-ear-plugin entries are added to the PLUGIN_UPGRADES list (used by getPluginUpgradesAsMap() for effective model analysis) but not to getPluginUpgradesMap() (the manually-maintained HashMap used by upgradePluginsInDocument() for direct POM XML scanning). This means POMs that directly declare these plugins with explicit versions will not be upgraded through the document scanning path.

All 15 other plugins appear in both locations. This exact inconsistency class was previously identified and fixed in PR #12200.

Suggested fix — add to getPluginUpgradesMap() before the return upgrades; statement:

upgrades.put(
        DEFAULT_MAVEN_PLUGIN_GROUP_ID + ":maven-war-plugin",
        new PluginUpgradeInfo(DEFAULT_MAVEN_PLUGIN_GROUP_ID, "maven-war-plugin", "3.4.0"));
upgrades.put(
        DEFAULT_MAVEN_PLUGIN_GROUP_ID + ":maven-ear-plugin",
        new PluginUpgradeInfo(DEFAULT_MAVEN_PLUGIN_GROUP_ID, "maven-ear-plugin", "3.4.0"));

2. No tests for the new plugins (medium severity)

The existing test suite has individual test cases for surefire, failsafe, surefire-report, jaxb2, and quarkus. Following this established pattern, tests should verify that old versions of maven-war-plugin and maven-ear-plugin are upgraded to 3.4.0.

This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.

Claude Code on behalf of gnodet

@gnodet gnodet added this to the 4.0.0-rc-7 milestone Aug 6, 2026
Both plugins use reflection on java.util.Properties internals (via
XStream/plexus-archiver) in older versions, which is blocked by the
JDK 17+ module system. Since Maven 4 requires JDK 17+, mvnup should
upgrade these plugins to compatible versions:

- maven-war-plugin: min 3.4.0 (fixed in 3.3.2+)
- maven-ear-plugin: min 3.4.0 (fixed in 3.3.0+)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gnodet
gnodet force-pushed the mvnup-war-ear-plugin branch from 9d1de4d to 1e0eb72 Compare August 6, 2026 06:28

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: [mvnup] Add maven-war-plugin and maven-ear-plugin to plugin upgrade list

Good intent — adding these two plugins to the upgrade list is the right move. Two issues found:

Confirmed findings:

  1. [high] getPluginUpgradesMap() not updated — needs rebase — The new maven-war-plugin and maven-ear-plugin entries were added to PLUGIN_UPGRADES but not to getPluginUpgradesMap(), which is a separate manually-constructed HashMap used by upgradePluginsInDocument(). This means POMs with explicit inline plugin versions will not get these two plugins upgraded. The target branch (maven-4.0.x) has already refactored getPluginUpgradesMap() to derive from PLUGIN_UPGRADES (commit 32217cc20e), so rebasing this PR onto the latest maven-4.0.x will fix this automatically.

  2. [low] Reason text version mismatch — For maven-war-plugin, the reason says "Versions before 3.3.2 use reflection..." but minVersion is 3.4.0. Similarly for maven-ear-plugin: "Versions before 3.3.0" but minVersion is 3.4.0. Other plugins with custom reason text consistently match their version numbers (e.g., scala-maven-plugin says "before 4.9.5" with minVersion 4.9.5). Consider aligning the reason text with the enforced minimum.


This review was generated by an AI agent (Claude Code) and may contain inaccuracies. Please verify all suggestions before applying.

Claude Code on behalf of Guillaume Nodet

gnodet added a commit to gnodet/maven that referenced this pull request Aug 16, 2026
@gnodet gnodet added the mvn4 label Aug 24, 2026

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review — clean data-only change adding war/ear plugins to mvnup

Both getPluginUpgradesMap() and getPluginUpgradesAsMap() derive dynamically from PLUGIN_UPGRADES.stream(), so adding entries to the list automatically propagates to all code paths. The 4-argument PluginUpgrade constructor correctly sets latestPreRelease to null. Existing parametric tests validate all entries.

Minor observation

Reason-string / minVersion mismatch — All 4 existing entries with "Versions before X" reason strings set X equal to the minVersion (e.g., scala-maven-plugin: "before 4.9.5" / minVersion 4.9.5). The two new entries break this pattern:

  • maven-war-plugin: reason says "before 3.3.2" but minVersion is 3.4.0
  • maven-ear-plugin: reason says "before 3.3.0" but minVersion is 3.4.0

Functionally correct (3.4.0 > described fix versions), but the inconsistency could confuse future maintainers. Consider aligning either the reason string or the minVersion.


This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.

Claude Code on behalf of Guillaume Nodet

@gnodet gnodet added the enhancement New feature or request label Aug 26, 2026
@gnodet
gnodet merged commit e8acffa into apache:maven-4.0.x Aug 26, 2026
22 checks passed
gnodet added a commit that referenced this pull request Aug 27, 2026
…ist (#12685) (#12850)

Both plugins use reflection on java.util.Properties internals (via
XStream/plexus-archiver) in older versions, which is blocked by the
JDK 17+ module system. Since Maven 4 requires JDK 17+, mvnup should
upgrade these plugins to compatible versions:

- maven-war-plugin: min 3.4.0 (fixed in 3.3.2+)
- maven-ear-plugin: min 3.4.0 (fixed in 3.3.0+)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request mvn4

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants