Fix IT failures caused by Maven 3.10.0 stricter validation level - #447
Conversation
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 <noreply@anthropic.com>
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.
gnodet-bot
left a comment
There was a problem hiding this comment.
The fix is correct and well-reasoned. Two notes:
MNG-1701 / MNG-4005: Accepting either [WARNING] or [ERROR] is the right call. Version-boundary checks via matchesVersionRange are unreliable when the behavioral change landed after an RC (removePattern strips the qualifier, so 3.10.0-rc-1 looks like 3.10.0 to the range check). The second commit addresses exactly this.
MNG-3719 POM merge: Merging the two maven-it-plugin-log-file declarations into one is the correct fix — keeping the duplicate would just permanently fail on 3.10.0+. Worth noting that the test originally targeted the merge ordering behavior (two separate plugin declarations being merged by Maven, then run interleaved with a third plugin). After this fix, the POM has a straightforward single-declaration ordering, so the test no longer exercises merge semantics — it now just tests explicit declaration order. The assertion step1 < step3 < step2 still passes because steps 1 and 3 are declared first (under maven-it-plugin-log-file) and step 2 second (under maven-it-plugin-expression). The version range extension to [2.1.0-M2,) is correct now that the fixture is valid for all Maven versions.
This is a pragmatic fix — the original merge behavior is now an error, so the test must adapt. LGTM.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
Summary
Fixes IT failures on the
maven-3.10.xbranch caused by stricter validation introduced in Maven 3.10.0.Root Cause
Maven 3.10.0 changed
VALIDATION_LEVEL_STRICTfromVALIDATION_LEVEL_MAVEN_3_0toVALIDATION_LEVEL_MAVEN_3_1(commit af936f4). This promotes duplicate plugin and dependency declarations from[WARNING]to[ERROR]in strict mode.Three ITs were broken:
MavenITmng1701DuplicatePluginTest[WARNING]for duplicate plugin, got[ERROR]on Maven 3.10.xMavenITmng4005UniqueDependencyKeyTest[WARNING]for duplicate dependency, got[ERROR]on Maven 3.10.xMavenITmng3719PomExecutionOrderingTestmaven-it-plugin-log-filedeclarations (duplicate plugin), now rejected as a validation errorFix
MNG-1701 / MNG-4005: Update the
[WARNING]vs[ERROR]version check from(,4.0.0-alpha-1)to(,3.10.0)to correctly account for Maven 3.10.0's stricter validation level.MNG-3719: Merge the two separate
maven-it-plugin-log-fileplugin declarations in the test fixture POM into a single declaration with both executions (step 1andstep 3). The test still validates the expected execution ordering (step1 → step3 → step2). Extend the version range to include Maven 3.10.0+.Hermes Agent (Claude Sonnet 4.6) on behalf of Guillaume Nodet