Maven 3.10.x should use Maven 3.1 validation in strict mode - #1542
Conversation
|
Let's see CI, as it may have some quirks... |
|
Oups, not yet, these are IT failures... |
f92658b to
309feec
Compare
|
Companion IT PR: apache/maven-integration-testing#441 |
gnodet-bot
left a comment
There was a problem hiding this comment.
The test logic and constant change are sound. VALIDATION_LEVEL_STRICT = VALIDATION_LEVEL_MAVEN_3_1 is the right move for Maven 3.10.x — the 3.1 checks (duplicate plugins, bad version chars, bad snapshot format, bad/reserved repo IDs) have been stable since Maven 3.1 (2012), and promoting them to errors in a new minor is reasonable. The test split into *30 / default variants is clean and exhaustive.
One structural concern with duplicate-plugins-merged-pom.xml (see inline).
This review was generated by an AI agent, Hermès on behalf of @gnodet.
gnodet-bot
left a comment
There was a problem hiding this comment.
Re-review after 7f77651
Previous finding — addressed ✅
The activeByDefault fragility I flagged is now fixed: the profile uses <activation><property><name>activateFooProfile</name></property></activation> (activated when the property is set, not silently deactivated by other profiles), and the test explicitly activates it via setActiveProfileIds(["foo"]). This makes testDuplicatePluginDefinitionsMerged environment-independent. Good fix.
Remaining issue — PR title is wrong
The title says "Maven 3.9.x should use Maven 3.1 validation in strict mode" but the PR targets the maven-3.10.x branch with milestone 3.10.0. 3.9.x is a distinct release line that is not the target of this change. The title should read something like "Maven 3.10.x should use Maven 3.1 validation in strict mode" (or simply "Raise VALIDATION_LEVEL_STRICT to VALIDATION_LEVEL_MAVEN_3_1 for Maven 3.10.x"). This was already noted by @cstamas and is still not updated.
Validator logic — verified ✅
The tests correctly reflect the validator's getSeverity logic:
validateBannedCharactersandvalidate20ProperSnapshotVersionuseerrOn31→ ERROR at 3.1 strict.systemscope deprecation warning fires unconditionally at>= 3.1(not gated onerrOn31), sotestHardCodedSystemPathcorrectly expects 3 warnings (not errors) at strict level — the deprecation warning was new at 3.1 in the original validator, not promoted to an error.- All six test pairs (
testDuplicatePlugin30/testDuplicatePlugin,testReservedRepositoryId30/testReservedRepositoryId,testBadVersion30/testBadVersion,testBadSnapshotVersion30/testBadSnapshotVersion,testBadRepositoryId30/testBadRepositoryId,testHardCodedSystemPath,testSystemPathRefersToProjectBasedir) are complete and consistent.
Please update the PR title before merge.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
|
PR title updated to "Maven 3.10.x should use Maven 3.1 validation in strict mode" as suggested by @cstamas and noted in the re-review. |
- Set VALIDATION_LEVEL_STRICT = VALIDATION_LEVEL_MAVEN_3_1 so that 3.1-level checks (duplicate plugins, bad version chars, bad snapshot format, reserved/bad repository IDs) are reported as errors in strict mode, matching the maturity of the 3.1 checks since Maven 3.1 (2012) - Add tests for the new strict-mode behaviour (*30 variants vs default) - Fix fragile activeByDefault profile in test fixture: use explicit profile activation via setActiveProfileIds to avoid CI environments deactivating the profile when other profiles are active
7f77651 to
43f2ab8
Compare
Changes
VALIDATION_LEVEL_STRICTfromVALIDATION_LEVEL_MAVEN_3_0(30) toVALIDATION_LEVEL_MAVEN_3_1(31).In strict mode (the default for project builds), the
getSeverity(request, errorThreshold)method returnsERRORwhenvalidationLevel >= thresholdandWARNINGotherwise. By raising the strict level from 3.0 to 3.1, the following checks are promoted from warnings to errors:build/pluginslocalAdditional warnings are now emitted for:
systemscope dependency deprecationsystemPath${basedir}-relative system pathsThe test resource
duplicate-plugins-merged-pom.xmlwas updated to move the duplicate plugin into a profile (avoiding the raw validation error while still testing plugin merge behavior).Unit tests updated to explicitly use
VALIDATION_LEVEL_MAVEN_3_0where the test exercises pre-3.1 behavior, and to use the default (now 3.1) level where the stricter validation is expected.Companion IT PR: apache/maven-integration-testing#441