gnodet opened a new pull request, #12533:
URL: https://github.com/apache/maven/pull/12533
## Summary
Fixes #12531 — Plugins that resolve dependencies (cyclonedx-maven-plugin,
camel-spring-boot-generator) throw `IllegalArgumentException: Unsupported
repository type: class
org.eclipse.aether.resolution.ArtifactResult$NoRepository` when building the
dependency tree under Maven 4.
### Root cause
`ArtifactResult.NO_REPOSITORY` is a sentinel used in the resolver's mapped
exceptions for errors with no associated repository. When
`DefaultArtifactResolver.toResult()` converts these to the Maven API, the
`NO_REPOSITORY` key was mapped to a `null` key in the `Map<Repository,
List<Exception>>` exposed through `ResultItem.getExceptions()`. This null key
could cause `NullPointerException` in downstream code iterating over the
exceptions map.
### Changes
- **Filter out `NO_REPOSITORY` entries** from the mapped exceptions map in
`toResult()`, ensuring no null keys leak into the public API
- **Preserve all exceptions** (including `NO_REPOSITORY` ones) in a separate
flat list (`allExceptions`) so that `isMissing()` still correctly considers all
exceptions
- **Use `merge()`** when building the exceptions map for robustness against
duplicate keys
- **Add 3 unit tests** covering:
- `NO_REPOSITORY` entries don't produce null keys in the exceptions map
- `isMissing()` correctly considers `NO_REPOSITORY` exceptions (including
non-`ArtifactNotFoundException` types)
- Resolved artifacts with `NO_REPOSITORY` exceptions are handled properly
This builds on commit a2aed724 which added `NO_REPOSITORY` handling to
`AbstractSession.getRepository()`.
## Test plan
- [x] New unit tests: `DefaultArtifactResolverTest` (3 tests)
- [x] Module tests: `mvn verify` in `impl/maven-impl` (515 tests pass)
- [x] Full reactor build: `mvn clean install -DskipTests` passes
- [ ] Verify with affected plugins (cyclonedx-maven-plugin,
camel-spring-boot-generator) against this build
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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]