Introduce validation control - #12549
Conversation
Enables validation level choice in Maven Resolver validator. This change should go to every Maven version having `MavenValidator` (3.10, 4.0 and 4.1). Related: apache/maven-resolver#2007 Backport of: 5703b7d
gnodet
left a comment
There was a problem hiding this comment.
✅ Clean backport of merged PR #12520 (commit 5703b7d) to the maven-3.10.x branch.
The changes are minimal and correctly adapted for the 3.10.x branch:
- Traditional
switchstatement instead of switch expression (Java compatibility) javax.injectimports instead oforg.apache.maven.api.di- Config key defined as a local constant rather than referencing
Constants.MAVEN_RESOLVER_VALIDATION(which doesn't exist on 3.10.x) - Source files under
maven-core/rather thanimpl/maven-impl/
The offValidator = new Validator() {} pattern is correct — all five methods on the Validator interface are default methods, so the anonymous class produces a complete no-op validator.
Note: The same case-sensitivity concern from the maven-4.0.x companion PR (#12548) applies here — ConfigUtils.getEnum uses Enum.valueOf which is case-sensitive, but the documented values are lowercase. See the review on #12548 for details.
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
Claude Code on behalf of gnodet
Enables validation level choice in Maven Resolver validator.
This change should go to every Maven version having
MavenValidator(3.10, 4.0 and 4.1).Related: apache/maven-resolver#2007
Backport of: 5703b7d