use of org.eclipse.aether.repository.RemoteRepository in project spring-boot by spring-projects.
the class AetherGrapeEngineFactory method createRepositories.
private static List<RemoteRepository> createRepositories(List<RepositoryConfiguration> repositoryConfigurations) {
List<RemoteRepository> repositories = new ArrayList<>(repositoryConfigurations.size());
for (RepositoryConfiguration repositoryConfiguration : repositoryConfigurations) {
RemoteRepository.Builder builder = new RemoteRepository.Builder(repositoryConfiguration.getName(), "default", repositoryConfiguration.getUri().toASCIIString());
if (!repositoryConfiguration.getSnapshotsEnabled()) {
builder.setSnapshotPolicy(new RepositoryPolicy(false, RepositoryPolicy.UPDATE_POLICY_NEVER, RepositoryPolicy.CHECKSUM_POLICY_IGNORE));
}
repositories.add(builder.build());
}
return repositories;
}
use of org.eclipse.aether.repository.RemoteRepository in project pinpoint by naver.
the class DependencyResolver method get.
public static DependencyResolver get(String... repositoryUrls) {
RepositorySystem system = newRepositorySystem();
RepositorySystemSession session = newRepositorySystemSession(system);
List<RemoteRepository> repositories = newRepositories(repositoryUrls);
return new DependencyResolver(system, session, repositories);
}
use of org.eclipse.aether.repository.RemoteRepository in project intellij-community by JetBrains.
the class Maven3ServerEmbedderImpl method resolve.
private Artifact resolve(@NotNull final Artifact artifact, @NotNull final List<ArtifactRepository> repos) throws ArtifactResolutionException, ArtifactNotFoundException, RemoteException, org.eclipse.aether.resolution.ArtifactResolutionException {
final String mavenVersion = getMavenVersion();
// see https://youtrack.jetbrains.com/issue/IDEA-140208 for details
if (USE_MVN2_COMPATIBLE_DEPENDENCY_RESOLVING || StringUtil.compareVersionNumbers(mavenVersion, "3.2.5") < 0) {
MavenExecutionRequest request = new DefaultMavenExecutionRequest();
request.setRemoteRepositories(repos);
try {
getComponent(MavenExecutionRequestPopulator.class).populateFromSettings(request, myMavenSettings);
getComponent(MavenExecutionRequestPopulator.class).populateDefaults(request);
} catch (MavenExecutionRequestPopulationException e) {
throw new RuntimeException(e);
}
getComponent(ArtifactResolver.class).resolve(artifact, request.getRemoteRepositories(), myLocalRepository);
return artifact;
} else {
final MavenExecutionRequest request = createRequest(null, Collections.<String>emptyList(), Collections.<String>emptyList(), Collections.<String>emptyList());
for (ArtifactRepository artifactRepository : repos) {
request.addRemoteRepository(artifactRepository);
}
DefaultMaven maven = (DefaultMaven) getComponent(Maven.class);
RepositorySystemSession repositorySystemSession = maven.newRepositorySession(request);
final org.eclipse.aether.impl.ArtifactResolver artifactResolver = getComponent(org.eclipse.aether.impl.ArtifactResolver.class);
final MyLoggerFactory loggerFactory = new MyLoggerFactory();
if (artifactResolver instanceof DefaultArtifactResolver) {
((DefaultArtifactResolver) artifactResolver).setLoggerFactory(loggerFactory);
}
final org.eclipse.aether.RepositorySystem repositorySystem = getComponent(org.eclipse.aether.RepositorySystem.class);
if (repositorySystem instanceof DefaultRepositorySystem) {
((DefaultRepositorySystem) repositorySystem).setLoggerFactory(loggerFactory);
}
List<RemoteRepository> repositories = RepositoryUtils.toRepos(request.getRemoteRepositories());
repositories = repositorySystem.newResolutionRepositories(repositorySystemSession, repositories);
final ArtifactResult artifactResult = repositorySystem.resolveArtifact(repositorySystemSession, new ArtifactRequest(RepositoryUtils.toArtifact(artifact), repositories, null));
return RepositoryUtils.toArtifact(artifactResult.getArtifact());
}
}
use of org.eclipse.aether.repository.RemoteRepository in project bnd by bndtools.
the class BaselineMojo method getRepositories.
private List<RemoteRepository> getRepositories(Artifact artifact) {
List<RemoteRepository> aetherRepos = RepositoryUtils.toRepos(project.getRemoteArtifactRepositories());
if (includeDistributionManagement) {
RemoteRepository releaseDistroRepo;
if (artifact.isSnapshot()) {
MavenProject tmpClone = project.clone();
org.apache.maven.artifact.Artifact tmpArtifact = project.getArtifact();
tmpClone.setArtifact(tmpArtifact);
releaseDistroRepo = RepositoryUtils.toRepo(tmpClone.getDistributionManagementArtifactRepository());
} else {
releaseDistroRepo = RepositoryUtils.toRepo(project.getDistributionManagementArtifactRepository());
}
// Don't fail on projects without distributionManagement
if (releaseDistroRepo != null) {
aetherRepos.add(0, releaseDistroRepo);
}
}
return aetherRepos;
}
use of org.eclipse.aether.repository.RemoteRepository in project bnd by bndtools.
the class DependencyResolver method resolve.
public Map<File, ArtifactResult> resolve() throws MojoExecutionException {
if (resolvedDependencies != null) {
return resolvedDependencies;
}
DependencyResolutionRequest request = new DefaultDependencyResolutionRequest(project, session);
request.setResolutionFilter(new DependencyFilter() {
@Override
public boolean accept(DependencyNode node, List<DependencyNode> parents) {
if (node.getDependency() != null) {
return scopes.contains(node.getDependency().getScope());
}
return false;
}
});
DependencyResolutionResult result;
try {
result = resolver.resolve(request);
} catch (DependencyResolutionException e) {
throw new MojoExecutionException(e.getMessage(), e);
}
Map<File, ArtifactResult> dependencies = new HashMap<>();
DependencyNode dependencyGraph = result.getDependencyGraph();
if (dependencyGraph != null && !dependencyGraph.getChildren().isEmpty()) {
List<RemoteRepository> remoteRepositories = new ArrayList<>(project.getRemoteProjectRepositories());
ArtifactRepository deployRepo = project.getDistributionManagementArtifactRepository();
if (deployRepo != null) {
remoteRepositories.add(RepositoryUtils.toRepo(deployRepo));
}
discoverArtifacts(dependencies, dependencyGraph.getChildren(), project.getArtifact().getId(), remoteRepositories);
}
return resolvedDependencies = dependencies;
}
Aggregations