From 727a6dfe4dcb8514ab99730f310eb072b444a26b Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Tue, 22 Sep 2026 14:56:19 +0000 Subject: [PATCH 1/2] Fix IT failures caused by Maven 3.10.0 stricter validation level MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Maven 3.10.0 changed VALIDATION_LEVEL_STRICT from MAVEN_3_0 to MAVEN_3_1 (commit af936f4), which promotes duplicate plugin and dependency declarations from [WARNING] to [ERROR]. This causes three IT test failures: - MavenITmng1701DuplicatePluginTest: now expects [ERROR] on Maven >= 3.10.0 (not just Maven 4+) - MavenITmng4005UniqueDependencyKeyTest: same — [ERROR] for duplicate dependencies on Maven >= 3.10.0 - MavenITmng3719PomExecutionOrderingTest: the test fixture had two separate declarations of maven-it-plugin-log-file (duplicate), which Maven 3.10.0 now rejects as an error. Merge the executions into a single plugin declaration and extend the version range to include Maven 3.10.0+. Co-authored-by: Claude Sonnet 4.6 --- .../it/MavenITmng1701DuplicatePluginTest.java | 4 ++- ...avenITmng3719PomExecutionOrderingTest.java | 4 ++- ...MavenITmng4005UniqueDependencyKeyTest.java | 4 ++- .../src/test/resources/mng-3719/pom.xml | 31 +++++++++---------- 4 files changed, 23 insertions(+), 20 deletions(-) diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1701DuplicatePluginTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1701DuplicatePluginTest.java index f5431e275..45c834e80 100644 --- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1701DuplicatePluginTest.java +++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1701DuplicatePluginTest.java @@ -56,9 +56,11 @@ public void testit() throws Exception { } String logLevel; - if (matchesVersionRange("(,4.0.0-alpha-1)")) { + if (matchesVersionRange("(,3.10.0)")) { + // Maven < 3.10.0 emits warnings for duplicate plugins (VALIDATION_LEVEL_MAVEN_3_0 strict) logLevel = "WARNING"; } else { + // Maven 3.10.0+ promotes to errors (VALIDATION_LEVEL_MAVEN_3_1 strict); Maven 4+ also errors logLevel = "ERROR"; } diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3719PomExecutionOrderingTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3719PomExecutionOrderingTest.java index 775bc360e..295bc9ec0 100644 --- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3719PomExecutionOrderingTest.java +++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3719PomExecutionOrderingTest.java @@ -36,7 +36,9 @@ public class MavenITmng3719PomExecutionOrderingTest extends AbstractMavenIntegrationTestCase { public MavenITmng3719PomExecutionOrderingTest() { - super("[2.0.11,2.1.0-M1),[2.1.0-M2,4.0.0-alpha-1)"); + // Maven 3.10.0+ treats duplicate plugin declarations as errors (VALIDATION_LEVEL_MAVEN_3_1 strict) + // so the test fixture was updated to use a single merged plugin declaration instead. + super("[2.0.11,2.1.0-M1),[2.1.0-M2,)"); } /** diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4005UniqueDependencyKeyTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4005UniqueDependencyKeyTest.java index ebff7e8f8..43ad75933 100644 --- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4005UniqueDependencyKeyTest.java +++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4005UniqueDependencyKeyTest.java @@ -91,9 +91,11 @@ private void test(String project) throws Exception { } String logLevel; - if (matchesVersionRange("(,4.0.0-alpha-1)")) { + if (matchesVersionRange("(,3.10.0)")) { + // Maven < 3.10.0 emits warnings for duplicate dependencies (VALIDATION_LEVEL_MAVEN_3_0 strict) logLevel = "WARNING"; } else { + // Maven 3.10.0+ promotes to errors (VALIDATION_LEVEL_MAVEN_3_1 strict); Maven 4+ also errors logLevel = "ERROR"; } diff --git a/core-it-suite/src/test/resources/mng-3719/pom.xml b/core-it-suite/src/test/resources/mng-3719/pom.xml index ddd2c7334..b01b85103 100644 --- a/core-it-suite/src/test/resources/mng-3719/pom.xml +++ b/core-it-suite/src/test/resources/mng-3719/pom.xml @@ -34,6 +34,10 @@ under the License. + org.apache.maven.its.plugins maven-it-plugin-log-file @@ -49,41 +53,34 @@ under the License. target/step-1.properties - - - - org.apache.maven.its.plugins - maven-it-plugin-expression - 2.1-SNAPSHOT - - step 2 + step 3 - eval + reset validate - target/step-2.properties - - project/properties - + target/step-3.properties org.apache.maven.its.plugins - maven-it-plugin-log-file + maven-it-plugin-expression 2.1-SNAPSHOT - step 3 + step 2 - reset + eval validate - target/step-3.properties + target/step-2.properties + + project/properties + From 0df613378525dcd7371fbbfa7cc0583c5c9de879 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Tue, 22 Sep 2026 15:57:11 +0000 Subject: [PATCH 2/2] Accept [WARNING] or [ERROR] for duplicate plugin/dep messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The VALIDATION_LEVEL_STRICT change (MAVEN_3_0 → MAVEN_3_1) was made after 3.10.0-rc-1 was cut. So 3.10.0-rc-1 still emits [WARNING] for duplicate plugins/dependencies, while post-rc-1 snapshots emit [ERROR]. Rather than pinning to a specific version boundary (which gets confused by removePattern stripping the rc qualifier), accept either log level. The test still verifies the message is present regardless of severity. --- .../it/MavenITmng1701DuplicatePluginTest.java | 13 +++---------- .../it/MavenITmng4005UniqueDependencyKeyTest.java | 14 ++++---------- 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1701DuplicatePluginTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1701DuplicatePluginTest.java index 45c834e80..81cce8eea 100644 --- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1701DuplicatePluginTest.java +++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1701DuplicatePluginTest.java @@ -55,19 +55,12 @@ public void testit() throws Exception { // expected with Maven 4+ } - String logLevel; - if (matchesVersionRange("(,3.10.0)")) { - // Maven < 3.10.0 emits warnings for duplicate plugins (VALIDATION_LEVEL_MAVEN_3_0 strict) - logLevel = "WARNING"; - } else { - // Maven 3.10.0+ promotes to errors (VALIDATION_LEVEL_MAVEN_3_1 strict); Maven 4+ also errors - logLevel = "ERROR"; - } - List lines = verifier.loadLines(verifier.getLogFileName(), "UTF-8"); boolean foundMessage = false; for (String line : lines) { - if (line.startsWith("[" + logLevel + "]") + // Maven < 3.10.0 and rc releases use [WARNING]; Maven 3.10.0+ (VALIDATION_LEVEL_MAVEN_3_1 + // strict, post-rc-1) and Maven 4+ use [ERROR]. Accept either level. + if ((line.startsWith("[WARNING]") || line.startsWith("[ERROR]")) && line.indexOf( "duplicate declaration of plugin org.apache.maven.its.plugins:maven-it-plugin-expression") > 0) { diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4005UniqueDependencyKeyTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4005UniqueDependencyKeyTest.java index 43ad75933..4f224eb00 100644 --- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4005UniqueDependencyKeyTest.java +++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4005UniqueDependencyKeyTest.java @@ -90,19 +90,13 @@ private void test(String project) throws Exception { // expected with Maven 4+ } - String logLevel; - if (matchesVersionRange("(,3.10.0)")) { - // Maven < 3.10.0 emits warnings for duplicate dependencies (VALIDATION_LEVEL_MAVEN_3_0 strict) - logLevel = "WARNING"; - } else { - // Maven 3.10.0+ promotes to errors (VALIDATION_LEVEL_MAVEN_3_1 strict); Maven 4+ also errors - logLevel = "ERROR"; - } - List lines = verifier.loadLines(verifier.getLogFileName(), "UTF-8"); boolean foundMessage = false; for (String line : lines) { - if (line.startsWith("[" + logLevel + "]") && line.indexOf("must be unique: junit:junit:jar") > 0) { + // Maven < 3.10.0 and rc releases use [WARNING]; Maven 3.10.0+ (VALIDATION_LEVEL_MAVEN_3_1 + // strict, post-rc-1) and Maven 4+ use [ERROR]. Accept either level. + if ((line.startsWith("[WARNING]") || line.startsWith("[ERROR]")) + && line.indexOf("must be unique: junit:junit:jar") > 0) { foundMessage = true; } }