[maven-4.0.x] Use maven-api Version for mvnup plugin version comparison#12073
Merged
Conversation
Replace hand-rolled version comparison with Session.parseVersion() which correctly handles milestone/pre-release qualifiers. The previous implementation stripped qualifiers (e.g., 3.0.0-M1 → 3.0.0) causing pre-release versions to be incorrectly considered sufficient. This fixes 19 projects (flink-connectors, sling) using enforcer 3.0.0-M1 that mvnup failed to upgrade to 3.0.0. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
f7c482b to
2631458
Compare
gnodet
added a commit
that referenced
this pull request
May 19, 2026
gnodet
added a commit
that referenced
this pull request
May 19, 2026
rmannibucau
approved these changes
May 19, 2026
|
@gnodet Please assign appropriate label to PR according to the type of change. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Backport of #12072 to
maven-4.0.x.Replace the hand-rolled version comparison in
PluginUpgradeStrategy.isVersionBelow()withSession.parseVersion()from maven-api, which correctly handles milestone/pre-release qualifiers.Problem
The previous implementation stripped qualifiers before comparison:
This caused
isVersionBelow("3.0.0-M1", "3.0.0")to returnfalse— mvnup thought3.0.0-M1was already sufficient when it's actually a pre-release below3.0.0.This affected 19 projects in maven4-testing (16 flink-connectors + 3 sling projects) using
maven-enforcer-plugin:3.0.0-M1, which is incompatible with Maven 4.Fix
Use
Session.parseVersion()from maven-api which returns aComparable<Version>that correctly handles all version qualifier semantics:3.0.0-M1 < 3.0.0✓3.0.0-alpha-1 < 3.0.0✓3.0.0-RC1 < 3.0.0✓3.0.0-SNAPSHOT < 3.0.0✓Test plan
shouldUpgradeMilestoneVersionBelowRelease— verifies3.0.0-M1is upgraded to3.0.0Claude Code on behalf of Guillaume Nodet