MNG-6759: Fix issue where MavenMetadataSource failed to set the right… #294
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
… repositories when preparing artifact metadata
To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.
Please see the issue description at https://issues.apache.org/jira/browse/MNG-6759. The basic issue is that when there's a dependency graph like A -> B -> C, and C is in some non-Central repository listed by B's POM, Maven is supposed to look for it in the repositories listed by B. As of 3.6.2, this doesn't always happen.
The issue is caused by an oversight in d3ace78. When the optimization is triggered, the "pomRepositories" variable is not set. In the slow path, it will be set to the remoteRepositories of the parent artifact in the dependency trail.
I'd like advice on improving this fix, as I'm using a deprecated method which is probably not a good idea. The optimized path gets the Model of the artifact. I need a list of ArtifactRepository, but the Model only contains a list of Repository. Should I use a RepositorySystem to map them? It feels like a waste, as they already exist in the session's set of MavenProject. I'd get them from the ReactorReader, but it unfortunately only exposes the Model.