[mvnup] Add maven-war-plugin and maven-ear-plugin to plugin upgrade list - #12685
Conversation
gnodet
left a comment
There was a problem hiding this comment.
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
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>
9d1de4d to
1e0eb72
Compare
gnodet
left a comment
There was a problem hiding this comment.
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:
-
[high]
getPluginUpgradesMap()not updated — needs rebase — The new maven-war-plugin and maven-ear-plugin entries were added toPLUGIN_UPGRADESbut not togetPluginUpgradesMap(), which is a separate manually-constructedHashMapused byupgradePluginsInDocument(). This means POMs with explicit inline plugin versions will not get these two plugins upgraded. The target branch (maven-4.0.x) has already refactoredgetPluginUpgradesMap()to derive fromPLUGIN_UPGRADES(commit32217cc20e), so rebasing this PR onto the latestmaven-4.0.xwill fix this automatically. -
[low] Reason text version mismatch — For maven-war-plugin, the reason says "Versions before 3.3.2 use reflection..." but
minVersionis3.4.0. Similarly for maven-ear-plugin: "Versions before 3.3.0" butminVersionis3.4.0. Other plugins with custom reason text consistently match their version numbers (e.g., scala-maven-plugin says "before 4.9.5" withminVersion4.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
left a comment
There was a problem hiding this comment.
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
…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>
Summary
maven-war-plugin(min 3.4.0) to thePLUGIN_UPGRADESlist inPluginUpgradeStrategymaven-ear-plugin(min 3.4.0) to thePLUGIN_UPGRADESlist inPluginUpgradeStrategyBoth plugins use reflection on
java.util.Propertiesinternals (via XStream/plexus-archiver) in older versions, which is blocked by the JDK 17+ module system. Since Maven 4 requires JDK 17+,mvnupshould upgrade these plugins to compatible versions.Affected versions
maven-war-pluginPropertiesConverterreflects onProperties.defaultsfieldmaven-ear-pluginplexus-archiveruses reflection blocked by JDK 17+ modulesContext
Discovered during Maven 4 compatibility testing — projects like
mina-vysperusingmaven-war-plugin:2.1.1crash with:Running
mvnup applydidn't fix this becausemaven-war-pluginwasn't in the upgrade list.🤖 Generated with Claude Code