gnodet opened a new pull request, #11529:
URL: https://github.com/apache/maven/pull/11529
When multiple model parsers are registered (e.g., for YAML or TOML POMs) and
all parsers fail to parse a POM file, the error message now provides detailed
information about each parser's failure.
### Changes
- Changed `modelParsers` from `List<ModelParser>` to `Map<String,
ModelParser>` to preserve parser names for better error messages
- Added `buildDetailedErrorMessage()` method that generates a comprehensive
error report including:
- The POM file path
- The number of parsers attempted
- Each parser's error with line/column information when available
- The default XML reader's error
- Updated all call sites to use `Map.of()` instead of `List.of()`
- Added unit tests for the new error reporting functionality
### Example Error Output
When a YAML POM file fails to parse:
```
Unable to parse POM /path/to/pom.yaml
Tried 2 parsers:
yaml) YAML parsing failed at line 5, column 10: Invalid YAML syntax
toml) TOML parsing failed at line 3, column 7
default) XML reader also failed: XML parsing failed
```
This improves debugging when using alternative POM formats by showing
exactly why each parser failed, rather than just the final XML error.
---
Pull Request opened by [Augment Code](https://www.augmentcode.com/) with
guidance from the PR author
--
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]