use of org.eclipse.aether.artifact.DefaultArtifact 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.artifact.DefaultArtifact in project buck by facebook.
the class Resolver method resolveLib.
private Prebuilt resolveLib(Artifact artifact, Path project) throws ArtifactResolutionException, IOException {
Artifact jar = new DefaultArtifact(artifact.getGroupId(), artifact.getArtifactId(), "jar", artifact.getVersion());
Path relativePath = resolveArtifact(jar, project);
Prebuilt library = new Prebuilt(jar.getArtifactId(), jar.toString(), relativePath);
downloadSources(jar, project, library);
return library;
}
use of org.eclipse.aether.artifact.DefaultArtifact in project druid by druid-io.
the class PullDependenciesTest method getArtifactsForExtension.
private List<Artifact> getArtifactsForExtension(Artifact artifact) {
final List<String> jarNames = extensionToJars.get(artifact);
final List<Artifact> artifacts = Lists.newArrayList();
for (String jarName : jarNames) {
final File jarFile = new File(localRepo, jarName);
try {
jarFile.createNewFile();
} catch (IOException e) {
Throwables.propagate(e);
}
artifacts.add(new DefaultArtifact(null, jarName, null, "jar", "1.0", null, jarFile));
}
return artifacts;
}
use of org.eclipse.aether.artifact.DefaultArtifact in project bazel by bazelbuild.
the class ResultWriterTest method testBuildFile.
@Test
public void testBuildFile() throws Exception {
Rule rule = new Rule(new DefaultArtifact("x:y:1.2.3"));
Rule dep1 = new Rule(new DefaultArtifact("dep:dep1:4.5.6"));
rule.addDependency(dep1);
Rule dep2 = new Rule(new DefaultArtifact("dep:dep2:7.8.9"));
rule.addDependency(dep2);
Set<Rule> rules = ImmutableSet.of(rule, dep1, dep2);
String content = getBuildFileContent(ImmutableList.<String>of(), rules);
assertThat(content).contains("java_library(\n" + " name = \"x_y\",\n" + " visibility = [\"//visibility:public\"],\n" + " exports = [\n" + " \"@x_y//jar\",\n" + " \"@dep_dep1//jar\",\n" + " \"@dep_dep2//jar\",\n" + " ],\n" + ")");
}
use of org.eclipse.aether.artifact.DefaultArtifact in project bazel by bazelbuild.
the class ResultWriterTest method testParents.
@Test
public void testParents() throws Exception {
Rule rule = new Rule(new DefaultArtifact("x:y:1.2.3"));
rule.addParent("some parent");
Set<Rule> rules = ImmutableSet.of(rule);
String content = getWorkspaceFileContent(ImmutableList.<String>of(), rules);
assertThat(content).contains("# some parent\n" + "maven_jar(\n" + " name = \"x_y\",\n" + " artifact = \"x:y:1.2.3\",\n" + ")");
}
Aggregations