Skip to content

Commit 431bb39

Browse files
gnodetclaude
andauthored
Fix mvnup recommending non-existent maven-enforcer-plugin:3.5.2 (#12155)
The enforcer plugin has no 3.5.2 release (versions go 3.5.0 -> 3.6.0). The version was confused with maven-surefire-plugin which does have 3.5.2. Changed the recommended minimum to 3.5.0, which is a real release. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 5583525 commit 431bb39

2 files changed

Lines changed: 5 additions & 8 deletions

File tree

impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnup/goals/PluginUpgradeStrategy.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,7 @@ public class PluginUpgradeStrategy extends AbstractUpgradeStrategy {
7171
new PluginUpgrade(
7272
DEFAULT_MAVEN_PLUGIN_GROUP_ID, "maven-exec-plugin", "3.2.0", MAVEN_4_COMPATIBILITY_REASON),
7373
new PluginUpgrade(
74-
DEFAULT_MAVEN_PLUGIN_GROUP_ID,
75-
"maven-enforcer-plugin",
76-
"3.5.2",
77-
"Versions before 3.5.2 use removed PluginParameterExpressionEvaluator API incompatible with Maven 4"),
74+
DEFAULT_MAVEN_PLUGIN_GROUP_ID, "maven-enforcer-plugin", "3.5.0", MAVEN_4_COMPATIBILITY_REASON),
7875
new PluginUpgrade("org.codehaus.mojo", "flatten-maven-plugin", "1.2.7", MAVEN_4_COMPATIBILITY_REASON),
7976
new PluginUpgrade(
8077
DEFAULT_MAVEN_PLUGIN_GROUP_ID, "maven-shade-plugin", "3.5.0", MAVEN_4_COMPATIBILITY_REASON),
@@ -243,7 +240,7 @@ private Map<String, PluginUpgradeInfo> getPluginUpgradesMap() {
243240
new PluginUpgradeInfo("org.codehaus.mojo", "exec-maven-plugin", "3.2.0"));
244241
upgrades.put(
245242
DEFAULT_MAVEN_PLUGIN_GROUP_ID + ":maven-enforcer-plugin",
246-
new PluginUpgradeInfo(DEFAULT_MAVEN_PLUGIN_GROUP_ID, "maven-enforcer-plugin", "3.5.2"));
243+
new PluginUpgradeInfo(DEFAULT_MAVEN_PLUGIN_GROUP_ID, "maven-enforcer-plugin", "3.5.0"));
247244
upgrades.put(
248245
"org.codehaus.mojo:flatten-maven-plugin",
249246
new PluginUpgradeInfo("org.codehaus.mojo", "flatten-maven-plugin", "1.2.7"));

impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/PluginUpgradeStrategyTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,14 +216,14 @@ void shouldUpgradeMilestoneVersionBelowRelease() throws Exception {
216216
UpgradeResult result = strategy.doApply(context, pomMap);
217217

218218
assertTrue(result.success(), "Plugin upgrade should succeed");
219-
assertTrue(result.modifiedCount() > 0, "Should have upgraded 3.0.0-M1 to 3.5.2");
219+
assertTrue(result.modifiedCount() > 0, "Should have upgraded 3.0.0-M1 to 3.5.0");
220220

221221
Editor editor = new Editor(document);
222222
String version = editor.root()
223223
.path("build", "plugins", "plugin", "version")
224224
.map(Element::textContentTrimmed)
225225
.orElse(null);
226-
assertEquals("3.5.2", version, "3.0.0-M1 should be upgraded to 3.5.2");
226+
assertEquals("3.5.0", version, "3.0.0-M1 should be upgraded to 3.5.0");
227227
}
228228

229229
@Test
@@ -265,7 +265,7 @@ void shouldUpgradePluginInPluginManagement() throws Exception {
265265
String version = root.path("build", "pluginManagement", "plugins", "plugin", "version")
266266
.map(Element::textContentTrimmed)
267267
.orElse(null);
268-
assertEquals("3.5.2", version);
268+
assertEquals("3.5.0", version);
269269
}
270270

271271
@Test

0 commit comments

Comments
 (0)