You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by gn...@apache.org on 2026/05/19 19:25:28 UTC
(maven) branch gnodet/backport/maven-4.0.x/pr-12113 created (now ee294d6cdd)
This is an automated email from the ASF dual-hosted git repository.
gnodet pushed a change to branch gnodet/backport/maven-4.0.x/pr-12113
in repository https://gitbox.apache.org/repos/asf/maven.git
at ee294d6cdd [maven-4.0.x] Add maven-surefire-report-plugin to PluginUpgradeStrategy
This branch includes the following new commits:
new ee294d6cdd [maven-4.0.x] Add maven-surefire-report-plugin to PluginUpgradeStrategy
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(maven) 01/01: [maven-4.0.x] Add maven-surefire-report-plugin to PluginUpgradeStrategy
Posted by gn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
gnodet pushed a commit to branch gnodet/backport/maven-4.0.x/pr-12113
in repository https://gitbox.apache.org/repos/asf/maven.git
commit ee294d6cdd51f77e7277221363ec07e2c349f680
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Tue May 19 21:25:14 2026 +0200
[maven-4.0.x] Add maven-surefire-report-plugin to PluginUpgradeStrategy
The surefire-report plugin is released from the same Maven Surefire
project as surefire and failsafe plugins, sharing the same version
and Maven 4 compatibility constraints. Add it with the same 3.5.2
minimum version to keep all three in sync.
Backport of #12113.
Co-Authored-By: Claude Opus 4.6 <no...@anthropic.com>
---
.../invoker/mvnup/goals/PluginUpgradeStrategy.java | 10 +++++-
.../mvnup/goals/PluginUpgradeStrategyTest.java | 42 ++++++++++++++++++++++
2 files changed, 51 insertions(+), 1 deletion(-)
diff --git a/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnup/goals/PluginUpgradeStrategy.java b/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnup/goals/PluginUpgradeStrategy.java
index 64fc99e907..8a10a4b872 100644
--- a/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnup/goals/PluginUpgradeStrategy.java
+++ b/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnup/goals/PluginUpgradeStrategy.java
@@ -102,7 +102,12 @@ public class PluginUpgradeStrategy extends AbstractUpgradeStrategy {
new PluginUpgrade(
DEFAULT_MAVEN_PLUGIN_GROUP_ID, "maven-surefire-plugin", "3.5.2", MAVEN_4_COMPATIBILITY_REASON),
new PluginUpgrade(
- DEFAULT_MAVEN_PLUGIN_GROUP_ID, "maven-failsafe-plugin", "3.5.2", MAVEN_4_COMPATIBILITY_REASON));
+ DEFAULT_MAVEN_PLUGIN_GROUP_ID, "maven-failsafe-plugin", "3.5.2", MAVEN_4_COMPATIBILITY_REASON),
+ new PluginUpgrade(
+ DEFAULT_MAVEN_PLUGIN_GROUP_ID,
+ "maven-surefire-report-plugin",
+ "3.5.2",
+ MAVEN_4_COMPATIBILITY_REASON));
private Session session;
@@ -256,6 +261,9 @@ private Map<String, PluginUpgradeInfo> getPluginUpgradesMap() {
upgrades.put(
DEFAULT_MAVEN_PLUGIN_GROUP_ID + ":maven-failsafe-plugin",
new PluginUpgradeInfo(DEFAULT_MAVEN_PLUGIN_GROUP_ID, "maven-failsafe-plugin", "3.5.2"));
+ upgrades.put(
+ DEFAULT_MAVEN_PLUGIN_GROUP_ID + ":maven-surefire-report-plugin",
+ new PluginUpgradeInfo(DEFAULT_MAVEN_PLUGIN_GROUP_ID, "maven-surefire-report-plugin", "3.5.2"));
return upgrades;
}
diff --git a/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/PluginUpgradeStrategyTest.java b/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/PluginUpgradeStrategyTest.java
index e63c364225..5e5b9540bc 100644
--- a/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/PluginUpgradeStrategyTest.java
+++ b/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/PluginUpgradeStrategyTest.java
@@ -389,6 +389,45 @@ void shouldUpgradeFailsafePluginWhenBelowMinimum() throws Exception {
assertEquals("3.5.2", version);
}
+ @Test
+ @DisplayName("should upgrade surefire-report plugin when below minimum")
+ void shouldUpgradeSurefireReportPluginWhenBelowMinimum() throws Exception {
+ String pomXml = """
+ <?xml version="1.0" encoding="UTF-8"?>
+ <project xmlns="http://maven.apache.org/POM/4.0.0">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>test</groupId>
+ <artifactId>test</artifactId>
+ <version>1.0.0</version>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-report-plugin</artifactId>
+ <version>3.1.2</version>
+ </plugin>
+ </plugins>
+ </build>
+ </project>
+ """;
+
+ Document document = Document.of(pomXml);
+ Map<Path, Document> pomMap = Map.of(Paths.get("pom.xml"), document);
+
+ UpgradeContext context = createMockContext();
+ UpgradeResult result = strategy.doApply(context, pomMap);
+
+ assertTrue(result.success(), "Plugin upgrade should succeed");
+ assertTrue(result.modifiedCount() > 0, "Should have upgraded maven-surefire-report-plugin");
+
+ Editor editor = new Editor(document);
+ Element root = editor.root();
+ String version = root.path("build", "plugins", "plugin", "version")
+ .map(Element::textContentTrimmed)
+ .orElse(null);
+ assertEquals("3.5.2", version);
+ }
+
@Test
@DisplayName("should not upgrade when version is already higher")
void shouldNotUpgradeWhenVersionAlreadyHigher() throws Exception {
@@ -616,11 +655,14 @@ void shouldHavePredefinedPluginUpgrades() throws Exception {
upgrades.stream().anyMatch(upgrade -> "maven-surefire-plugin".equals(upgrade.artifactId()));
boolean hasFailsafePlugin =
upgrades.stream().anyMatch(upgrade -> "maven-failsafe-plugin".equals(upgrade.artifactId()));
+ boolean hasSurefireReportPlugin =
+ upgrades.stream().anyMatch(upgrade -> "maven-surefire-report-plugin".equals(upgrade.artifactId()));
assertTrue(hasCompilerPlugin, "Should include maven-compiler-plugin upgrade");
assertTrue(hasExecPlugin, "Should include maven-exec-plugin upgrade");
assertTrue(hasSurefirePlugin, "Should include maven-surefire-plugin upgrade");
assertTrue(hasFailsafePlugin, "Should include maven-failsafe-plugin upgrade");
+ assertTrue(hasSurefireReportPlugin, "Should include maven-surefire-report-plugin upgrade");
}
@Test