use of org.eclipse.aether.graph.Exclusion in project buck by facebook.
the class Resolver method getDependenciesFromPom.
private ImmutableList<Dependency> getDependenciesFromPom(Model model) {
return model.getDependencies().stream().map(dep -> {
ArtifactType stereotype = session.getArtifactTypeRegistry().get(dep.getType());
if (stereotype == null) {
stereotype = new DefaultArtifactType(dep.getType());
}
Map<String, String> props = null;
boolean system = dep.getSystemPath() != null && dep.getSystemPath().length() > 0;
if (system) {
props = ImmutableMap.of(ArtifactProperties.LOCAL_PATH, dep.getSystemPath());
}
@SuppressWarnings("PMD.PrematureDeclaration") DefaultArtifact artifact = new DefaultArtifact(dep.getGroupId(), dep.getArtifactId(), dep.getClassifier(), null, dep.getVersion(), props, stereotype);
ImmutableList<Exclusion> exclusions = FluentIterable.from(dep.getExclusions()).transform(input -> {
String group = input.getGroupId();
String artifact1 = input.getArtifactId();
group = (group == null || group.length() == 0) ? "*" : group;
artifact1 = (artifact1 == null || artifact1.length() == 0) ? "*" : artifact1;
return new Exclusion(group, artifact1, "*", "*");
}).toList();
return new Dependency(artifact, dep.getScope(), dep.isOptional(), exclusions);
}).collect(MoreCollectors.toImmutableList());
}
use of org.eclipse.aether.graph.Exclusion in project spring-boot by spring-projects.
the class DependencyResolutionContext method addDependencyManagement.
public void addDependencyManagement(DependencyManagement dependencyManagement) {
for (org.springframework.boot.cli.compiler.dependencies.Dependency dependency : dependencyManagement.getDependencies()) {
List<Exclusion> aetherExclusions = new ArrayList<>();
for (org.springframework.boot.cli.compiler.dependencies.Dependency.Exclusion exclusion : dependency.getExclusions()) {
aetherExclusions.add(new Exclusion(exclusion.getGroupId(), exclusion.getArtifactId(), "*", "*"));
}
Dependency aetherDependency = new Dependency(new DefaultArtifact(dependency.getGroupId(), dependency.getArtifactId(), "jar", dependency.getVersion()), JavaScopes.COMPILE, false, aetherExclusions);
this.managedDependencies.add(0, aetherDependency);
this.managedDependencyByGroupAndArtifact.put(getIdentifier(aetherDependency), aetherDependency);
}
this.dependencyManagement = this.dependencyManagement == null ? dependencyManagement : new CompositeDependencyManagement(dependencyManagement, this.dependencyManagement);
this.artifactCoordinatesResolver = new DependencyManagementArtifactCoordinatesResolver(this.dependencyManagement);
}
use of org.eclipse.aether.graph.Exclusion in project spring-boot by spring-projects.
the class AetherGrapeEngine method grab.
@Override
public Object grab(Map args, Map... dependencyMaps) {
List<Exclusion> exclusions = createExclusions(args);
List<Dependency> dependencies = createDependencies(dependencyMaps, exclusions);
try {
List<File> files = resolve(dependencies);
GroovyClassLoader classLoader = getClassLoader(args);
for (File file : files) {
classLoader.addURL(file.toURI().toURL());
}
} catch (ArtifactResolutionException ex) {
throw new DependencyResolutionFailedException(ex);
} catch (MalformedURLException ex) {
throw new DependencyResolutionFailedException(ex);
}
return null;
}
use of org.eclipse.aether.graph.Exclusion in project spring-boot by spring-projects.
the class AetherGrapeEngine method resolve.
@Override
public URI[] resolve(Map args, List depsInfo, Map... dependencyMaps) {
List<Exclusion> exclusions = createExclusions(args);
List<Dependency> dependencies = createDependencies(dependencyMaps, exclusions);
try {
List<File> files = resolve(dependencies);
List<URI> uris = new ArrayList<>(files.size());
for (File file : files) {
uris.add(file.toURI());
}
return uris.toArray(new URI[uris.size()]);
} catch (Exception ex) {
throw new DependencyResolutionFailedException(ex);
}
}
Aggregations