Maven Resolver question re: local repo and mirrors

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Maven Resolver question re: local repo and mirrors

Hello; I'm putting together a client, I guess, of the Maven Artifact
Resolver APIs (

I am trying to make my client be as Maven-like as possible.  So I'm using,
among other things, MavenRepositorySystemUtils.  I can, of course, go into
more details if needed; this is intended to be a shorthand that says I
mostly know what I'm doing.  :-)

(Another way to put this is I am following recipes you can find here (,
bearing in mind that Aether has of course become maven-resolver
so obviously there are a few tweaks here and there.)

I understand most of this, but is there a component I can use that includes
the automagic usage of mirrors etc. from a Maven ~/.m2/settings.xml file?
My sense is if I just do:

final LocalRepository localRepository = new
final LocalRepositoryManager localRepositoryManager =


final RemoteRepository mavenCentral = new
RemoteRepository.Builder("central", "default", "").build();
// now use this and localRepository in a CollectRequest or the like

…I'm not getting the (useful) magic of a Maven settings.xml file.  I
wouldn't really expect to, either, since this is just usage of the
project-formerly-known-as-Aether, not some deep Maven integration.

What is the recipe to include this as well?  I had a brief look in Maven
core—think an explorer encountering a dark ominous cave with a flaming
torch running out of fuel, backing away slowly—but wasn't sure where to