gnodet opened a new pull request, #12072:
URL: https://github.com/apache/maven/pull/12072
## Summary
Replace the hand-rolled version comparison in
`PluginUpgradeStrategy.isVersionBelow()` with `ComparableVersion` which
correctly handles milestone/pre-release qualifiers.
## Problem
The previous implementation stripped qualifiers before comparison:
```java
String cleanCurrent = currentVersion.split("-")[0]; // "3.0.0-M1" → "3.0.0"
```
This caused `isVersionBelow("3.0.0-M1", "3.0.0")` to return `false` — mvnup
thought `3.0.0-M1` was already sufficient when it's actually a pre-release
below `3.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 `ComparableVersion` from `maven-artifact` (already a dependency of
`maven-cli`) which 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
- [x] All existing tests pass (19/19)
- [x] New test: `shouldUpgradeMilestoneVersionBelowRelease` — verifies
`3.0.0-M1` is upgraded to `3.0.0`
Test results: https://github.com/gnodet/maven4-testing/issues/9934
_Claude Code on behalf of Guillaume Nodet_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]