use of org.sonatype.aether.util.artifact.DefaultArtifact in project sonatype-aether by sonatype.
the class AetherDemo method installAndDeploy.
public void installAndDeploy() throws InstallationException, DeploymentException {
Aether aether = new Aether("http://localhost:8081/nexus/content/groups/public", "/Users/jvanzyl/aether-repo");
Artifact artifact = new DefaultArtifact("com.mycompany.super", "super-core", "jar", "0.1-SNAPSHOT");
artifact = artifact.setFile(new File("jar-from-whatever-process.jar"));
Artifact pom = new SubArtifact(artifact, null, "pom");
pom = pom.setFile(new File("pom-from-whatever-process.xml"));
// Install into the local repository specified
//
aether.install(artifact, pom);
// Deploy to a remote reposistory
//
aether.deploy(artifact, pom, "http://localhost:8081/nexus/content/repositories/snapshots/");
}
use of org.sonatype.aether.util.artifact.DefaultArtifact in project zeppelin by apache.
the class SparkDependencyContext method fetchArtifactWithDep.
private List<ArtifactResult> fetchArtifactWithDep(Dependency dep) throws DependencyResolutionException, ArtifactResolutionException {
Artifact artifact = new DefaultArtifact(SparkDependencyResolver.inferScalaVersion(dep.getGroupArtifactVersion()));
DependencyFilter classpathFlter = DependencyFilterUtils.classpathFilter(JavaScopes.COMPILE);
PatternExclusionsDependencyFilter exclusionFilter = new PatternExclusionsDependencyFilter(SparkDependencyResolver.inferScalaVersion(dep.getExclusions()));
CollectRequest collectRequest = new CollectRequest();
collectRequest.setRoot(new org.sonatype.aether.graph.Dependency(artifact, JavaScopes.COMPILE));
collectRequest.addRepository(mavenCentral);
collectRequest.addRepository(mavenLocal);
for (RemoteRepository repo : additionalRepos) {
collectRequest.addRepository(repo);
}
for (Repository repo : repositories) {
RemoteRepository rr = new RemoteRepository(repo.getId(), "default", repo.getUrl());
rr.setPolicy(repo.isSnapshot(), null);
Authentication auth = repo.getAuthentication();
if (auth != null) {
rr.setAuthentication(auth);
}
collectRequest.addRepository(rr);
}
DependencyRequest dependencyRequest = new DependencyRequest(collectRequest, DependencyFilterUtils.andFilter(exclusionFilter, classpathFlter));
return system.resolveDependencies(session, dependencyRequest).getArtifactResults();
}
use of org.sonatype.aether.util.artifact.DefaultArtifact in project storm by apache.
the class AetherUtilsTest method artifactToString.
@Test
public void artifactToString() throws Exception {
Artifact testArtifact = new DefaultArtifact("org.apache.storm:storm-core:1.0.0");
String ret = AetherUtils.artifactToString(testArtifact);
assertEquals("org.apache.storm:storm-core:jar:1.0.0", ret);
}
use of org.sonatype.aether.util.artifact.DefaultArtifact in project gradle by gradle.
the class AbstractMavenPublishAction method createTypedArtifact.
private Artifact createTypedArtifact(String type, String classifier) {
String extension = type;
ArtifactType stereotype = session.getArtifactTypeRegistry().get(type);
if (stereotype != null) {
extension = stereotype.getExtension();
if (classifier == null) {
classifier = stereotype.getClassifier();
}
}
return new DefaultArtifact(pomArtifact.getGroupId(), pomArtifact.getArtifactId(), classifier, extension, pomArtifact.getVersion());
}
use of org.sonatype.aether.util.artifact.DefaultArtifact in project sonatype-aether by sonatype.
the class SimpleLocalRepositoryManagerTest method testFindArtifactUsesTimestampedVersion.
@Test
public void testFindArtifactUsesTimestampedVersion() throws Exception {
Artifact artifact = new DefaultArtifact("g.i.d:a.i.d:1.0-SNAPSHOT");
File file = new File(basedir, manager.getPathForLocalArtifact(artifact));
TestFileUtils.write("test", file);
artifact = artifact.setVersion("1.0-20110329.221805-4");
LocalArtifactRequest request = new LocalArtifactRequest();
request.setArtifact(artifact);
LocalArtifactResult result = manager.find(session, request);
assertNull(result.toString(), result.getFile());
assertFalse(result.toString(), result.isAvailable());
}
Aggregations