use of org.sonatype.aether.util.repository.DefaultMirrorSelector in project sonatype-aether by sonatype.
the class GetDependencyTreeWithMirror method main.
public static void main(String[] args) throws Exception {
System.out.println("------------------------------------------------------------");
System.out.println(GetDependencyTreeWithMirror.class.getSimpleName());
RepositorySystem system = Booter.newRepositorySystem();
RepositorySystemSession session = Booter.newRepositorySystemSession(system);
Artifact artifact = new DefaultArtifact("org.apache.maven:maven-aether-provider:3.0.2");
RemoteRepository central = new RemoteRepository("central", "default", "http://repo1.maven.org/maven2/");
DefaultMirrorSelector dms = (DefaultMirrorSelector) session.getMirrorSelector();
dms.add("mirror", "http://repo1.maven.org/maven2/", "default", true, "central", "*");
CollectRequest collectRequest = new CollectRequest();
collectRequest.setRoot(new Dependency(artifact, ""));
collectRequest.addRepository(central);
CollectResult collectResult = system.collectDependencies(session, collectRequest);
collectResult.getRoot().accept(new ConsoleDependencyGraphDumper());
}
Aggregations