use of org.sonatype.aether.artifact.Artifact in project zeppelin by apache.
the class SparkDependencyResolver method getArtifactsWithDep.
/**
* @param dependency
* @param excludes list of pattern can either be of the form groupId:artifactId
* @return
* @throws Exception
*/
@Override
public List<ArtifactResult> getArtifactsWithDep(String dependency, Collection<String> excludes) throws Exception {
Artifact artifact = new DefaultArtifact(inferScalaVersion(dependency));
DependencyFilter classpathFilter = DependencyFilterUtils.classpathFilter(JavaScopes.COMPILE);
PatternExclusionsDependencyFilter exclusionFilter = new PatternExclusionsDependencyFilter(inferScalaVersion(excludes));
CollectRequest collectRequest = new CollectRequest();
collectRequest.setRoot(new Dependency(artifact, JavaScopes.COMPILE));
synchronized (repos) {
for (RemoteRepository repo : repos) {
collectRequest.addRepository(repo);
}
}
DependencyRequest dependencyRequest = new DependencyRequest(collectRequest, DependencyFilterUtils.andFilter(exclusionFilter, classpathFilter));
return system.resolveDependencies(session, dependencyRequest).getArtifactResults();
}
use of org.sonatype.aether.artifact.Artifact in project storm by apache.
the class AetherUtils method parseDependency.
public static Dependency parseDependency(String dependency) {
List<String> dependencyAndExclusions = Arrays.asList(dependency.split("\\^"));
Collection<Exclusion> exclusions = new ArrayList<>();
for (int idx = 1; idx < dependencyAndExclusions.size(); idx++) {
exclusions.add(AetherUtils.createExclusion(dependencyAndExclusions.get(idx)));
}
Artifact artifact = new DefaultArtifact(dependencyAndExclusions.get(0));
return new Dependency(artifact, JavaScopes.COMPILE, false, exclusions);
}
use of org.sonatype.aether.artifact.Artifact in project storm by apache.
the class DependencyResolverMain method transformArtifactResultToArtifactToPaths.
private static Map<String, String> transformArtifactResultToArtifactToPaths(List<ArtifactResult> artifactResults) {
Map<String, String> artifactToPath = new LinkedHashMap<>();
for (ArtifactResult artifactResult : artifactResults) {
Artifact artifact = artifactResult.getArtifact();
artifactToPath.put(AetherUtils.artifactToString(artifact), artifact.getFile().getAbsolutePath());
}
return artifactToPath;
}
use of org.sonatype.aether.artifact.Artifact in project sonatype-aether by sonatype.
the class NodeBuilder method reloc.
public NodeBuilder reloc(String artifactId) {
Artifact relocation = new StubArtifact(groupId, artifactId, classifier, ext, version);
relocations.add(relocation);
return this;
}
use of org.sonatype.aether.artifact.Artifact in project sonatype-aether by sonatype.
the class PatternInclusionsDependencyFilter method accept.
public boolean accept(final DependencyNode node, List<DependencyNode> parents) {
final Dependency dependency = node.getDependency();
if (dependency == null) {
return true;
}
final Artifact artifact = dependency.getArtifact();
for (final String pattern : patterns) {
final boolean matched = accept(artifact, pattern);
if (matched) {
return true;
}
}
return false;
}
Aggregations