cmunier opened a new pull request, #13407:
URL: https://github.com/apache/maven/pull/13407

   `maven.resolver.validation` is documented with the values `default`, `mild` 
and `off` (Javadoc of `Constants.MAVEN_RESOLVER_VALIDATION`, 
`@Config(defaultValue = "default")`, and the Maven 3.10.0 release notes). 
However, `MavenValidatorFactory` parses the value with `ConfigUtils.getEnum()`, 
which uses `Enum.valueOf()` and is case-sensitive. Following the documentation 
therefore fails the build:
   
   ```
   $ mvn -Dmaven.resolver.validation=mild verify
   [ERROR] Internal error: java.lang.IllegalArgumentException: No enum constant 
org.apache.maven.internal.aether.MavenValidatorFactory.ValidationLevel.mild -> 
[Help 1]
   ```
   
   Only `MILD` and `OFF` work. This was noted in the review of #12549, and it 
affects the escape hatch that the 3.10.0 release notes recommend for builds 
with non-conformant coordinates.
   
   This PR parses the value ignoring case and surrounding whitespace, so both 
the documented lowercase values and the uppercase values that work today are 
accepted. An unknown value is now reported with the property name and the 
supported values:
   
   ```
   Invalid value 'foo' for maven.resolver.validation, supported values are: 
default, mild, off
   ```
   
   Tested with the new `MavenValidatorFactoryTest` (4 of its 5 tests fail 
without the change), and end to end with a distribution built from this branch, 
using a project with a `system`-scoped dependency whose classifier contains a 
`/`: without the property the build fails as expected, and it passes with 
`mild`, `MILD` and `Off`.
   
   **Backport:** the same code is in `maven-4.0.x` (`impl/maven-impl`) and 
`maven-3.10.x` (`maven-core`, 
`org.apache.maven.internal.aether.MavenValidatorFactory`). As 3.10.0 is 
released with this behavior, could this please be backported to both branches? 
I'm happy to open the backport PR for `maven-3.10.x` if you like.
   
   AI disclosure: drafted with Claude Code (Anthropic Claude Opus 5.5, 
interactive mode). I have reviewed and tested the change myself.
   
   ---
   
   - [x] I hereby declare this contribution to be licensed under the [Apache 
License Version 2.0, January 2004](https://www.apache.org/licenses/LICENSE-2.0)
   - [ ] I hereby declare that I have filed an [Apache Individual Contributor 
License Agreement](https://www.apache.org/licenses/icla.pdf).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to