Fix #12530: add mvnup upgrade strategies for Maven 4 known compatibility issues#12532
Fix #12530: add mvnup upgrade strategies for Maven 4 known compatibility issues#12532gnodet wants to merge 4 commits into
Conversation
…ity issues Add 4 new upgrade strategies (completing the 8 proposed in the issue): 1. Update maven-compiler-plugin minimum to 3.11.0 (ErrorProne classloading) 2. Detect and upgrade Maven 4 pre-release plugin versions (4.0.0-beta-1, 4.0.0-alpha-*, etc.) that use removed API methods renamed before RC 3. Migrate org.scala-tools:maven-scala-plugin to net.alchim31.maven:scala-maven-plugin:4.9.5 (unmaintained since 2011) 4. Remove duplicate XML elements (DuplicateElementStrategy) that Maven 4's stricter POM parser rejects but Maven 3 silently accepted The remaining 4 strategies already existed: - scala-maven-plugin >= 4.9.5 (in PLUGIN_UPGRADES) - maven-enforcer-plugin >= 3.0.0 (in PLUGIN_UPGRADES at 3.5.0) - exec-maven-plugin >= 3.2.0 (in PLUGIN_UPGRADES at 3.5.0) - Duplicate dependency declarations (DeduplicateDependenciesStrategy) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
No RC versions exist for these plugins, so the RC exclusion was dead code. Simplify isMaven4PreRelease() to catch any 4.0.0-* qualifier. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Previously, plugins at 4.0.0-beta-1 were downgraded to the 3.x minVersion floor. Now they are upgraded to the latest available 4.x pre-release instead: - maven-compiler-plugin: 4.0.0-beta-4 - maven-resources-plugin: 4.0.0-beta-1 (already latest) - maven-jar-plugin: 4.0.0-beta-1 (already latest) - maven-install-plugin: 4.0.0-beta-2 - maven-deploy-plugin: 4.0.0-beta-2 - maven-clean-plugin: 4.0.0-beta-2 Adds latestPreRelease field to PluginUpgrade/PluginUpgradeInfo. Deduplicates getPluginUpgradesMap() to derive from PLUGIN_UPGRADES. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gnodet
left a comment
There was a problem hiding this comment.
Code Review
Well-implemented PR that adds four new mvnup upgrade strategies for Maven 4 compatibility. The pre-release detection logic is correct, the DuplicateElementStrategy handles list containers properly, and the test coverage is solid with 31 new tests. All 8 strategies from issue #12530 are accounted for (4 new, 4 already existing).
Three minor notes (non-blocking):
buildElementPath(Element parent, Element child)— thechildparameter is never used; the method only walks up fromparent. Either remove the parameter or append the child's name to the path for a more complete log message.getPluginMigrationsMap()andgetPluginUpgradesMap()rebuild a new HashMap on every call. With only one migration entry this is negligible, but could be hoisted to static fields for consistency.- The deduplication of
getPluginUpgradesMap()(now derived from thePLUGIN_UPGRADESlist via stream) is a good cleanup that eliminates a previous source of inconsistency.
LGTM.
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
Claude Code on behalf of gnodet
- Remove unused child parameter from buildElementPath() - Cache pluginMigrationsMap as a static field Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Thanks for the review! Addressed all three points:
|
gnodet
left a comment
There was a problem hiding this comment.
Code Review (Re-review)
All three items from the previous review have been addressed in commit 80b938e:
- Unused
childparameter inbuildElementPath()— ✅ Removed. PLUGIN_MIGRATIONS_MAPrebuilt on every call — ✅ Hoisted to astatic finalfield.getPluginUpgradesMap()deduplication — ✅ Already derived fromPLUGIN_UPGRADESlist, eliminating the hand-maintained duplicate map.
One remaining minor note (non-blocking):
getPluginUpgradesMap()still rebuilds a HashMap fromPLUGIN_UPGRADES.stream()on every call (once per POM). Negligible with ~20 entries, but hoisting to astatic finalwould be consistent with howPLUGIN_MIGRATIONS_MAPwas handled.
The review-feedback commit is minimal and scoped precisely to the requested changes. LGTM.
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
Claude Code on behalf of gnodet
Summary
Adds 4 new mvnup upgrade strategies to address Maven 4 known compatibility issues from the maven4-testing project:
old-compiler-plugin-errorprone: Updatemaven-compiler-pluginminimum to3.11.0(older versions can't find ErrorProne plug-in under Maven 4 classloading)beta-plugin-api-break: Detect and upgrade Maven 4 pre-release plugin versions (4.0.0-beta-1,4.0.0-alpha-*, etc.) that use API methods renamed/removed before RCold-scala-tools-plugin: Migrateorg.scala-tools:maven-scala-plugin→net.alchim31.maven:scala-maven-plugin:4.9.5(unmaintained since 2011)duplicated-pom-tag: NewDuplicateElementStrategythat removes duplicate XML elements (<artifactId>,<properties>, etc.) that Maven 4's stricter POM parser rejectsThe remaining 4 strategies from the issue already existed:
scala-maven-plugin#911→ already inPLUGIN_UPGRADESat 4.9.5ancient-enforcer-plugin→ already inPLUGIN_UPGRADESat 3.5.0exec-plugin-getcontainer→ already inPLUGIN_UPGRADESat 3.5.0duplicate-dependency-declarations→ already inDeduplicateDependenciesStrategyChanges
PluginUpgradeStrategy.javaisMaven4PreRelease()detection, addedPluginMigrationsupport withmigratePlugin()methodPluginMigration.javaDuplicateElementStrategy.javaPluginUpgradeStrategyTest.javaDuplicateElementStrategyTest.javaTest plan
-Psourcecheck validate)🤖 Generated with Claude Code