use of org.eclipse.aether.resolution.ArtifactDescriptorResult in project buck by facebook.
the class Resolver method getDependenciesOf.
private List<Dependency> getDependenciesOf(Artifact dep) throws ArtifactDescriptorException {
ArtifactDescriptorRequest descriptorRequest = new ArtifactDescriptorRequest();
descriptorRequest.setArtifact(dep);
descriptorRequest.setRepositories(repos);
descriptorRequest.setRequestContext(JavaScopes.RUNTIME);
ArtifactDescriptorResult result = repoSys.readArtifactDescriptor(session, descriptorRequest);
return result.getDependencies();
}
use of org.eclipse.aether.resolution.ArtifactDescriptorResult in project camel by apache.
the class BOMResolver method retrieveUpstreamBOMVersions.
private void retrieveUpstreamBOMVersions() throws Exception {
RepositorySystem system = newRepositorySystem();
DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
LocalRepository localRepo = new LocalRepository(LOCAL_REPO);
session.setLocalRepositoryManager(system.newLocalRepositoryManager(session, localRepo));
String camelVersion = DependencyResolver.resolveCamelParentProperty("${project.version}");
List<Artifact> neededArtifacts = new LinkedList<>();
neededArtifacts.add(new DefaultArtifact("org.apache.camel:camel:pom:" + camelVersion).setFile(camelRoot("pom.xml")));
neededArtifacts.add(new DefaultArtifact("org.apache.camel:camel-parent:pom:" + camelVersion).setFile(camelRoot("parent/pom.xml")));
neededArtifacts.add(new DefaultArtifact("org.apache.camel:spring-boot:pom:" + camelVersion).setFile(camelRoot("platforms/spring-boot/pom.xml")));
neededArtifacts.add(new DefaultArtifact("org.apache.camel:camel-spring-boot-dm:pom:" + camelVersion).setFile(camelRoot("platforms/spring-boot/spring-boot-dm/pom.xml")));
neededArtifacts.add(new DefaultArtifact("org.apache.camel:camel-spring-boot-dependencies:pom:" + camelVersion).setFile(camelRoot("platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml")));
Artifact camelSpringBootParent = new DefaultArtifact("org.apache.camel:camel-starter-parent:pom:" + camelVersion).setFile(camelRoot("platforms/spring-boot/spring-boot-dm/camel-starter-parent/pom.xml"));
neededArtifacts.add(camelSpringBootParent);
RemoteRepository localRepoDist = new RemoteRepository.Builder("org.apache.camel.itest.springboot", "default", new File(LOCAL_REPO).toURI().toString()).build();
for (Artifact artifact : neededArtifacts) {
DeployRequest deployRequest = new DeployRequest();
deployRequest.addArtifact(artifact);
deployRequest.setRepository(localRepoDist);
system.deploy(session, deployRequest);
}
RemoteRepository mavenCentral = new RemoteRepository.Builder("central", "default", "http://repo1.maven.org/maven2/").build();
ArtifactDescriptorRequest dReq = new ArtifactDescriptorRequest(camelSpringBootParent, Arrays.asList(localRepoDist, mavenCentral), null);
ArtifactDescriptorResult dRes = system.readArtifactDescriptor(session, dReq);
this.versions = new TreeMap<>();
for (Dependency dependency : dRes.getManagedDependencies()) {
Artifact a = dependency.getArtifact();
String key = a.getGroupId() + ":" + a.getArtifactId();
versions.put(key, dependency.getArtifact().getVersion());
}
}
Aggregations