use of org.sonatype.aether.util.artifact.SubArtifact in project sonatype-aether by sonatype.
the class DeployArtifacts method main.
public static void main(String[] args) throws Exception {
System.out.println("------------------------------------------------------------");
System.out.println(DeployArtifacts.class.getSimpleName());
RepositorySystem system = Booter.newRepositorySystem();
RepositorySystemSession session = Booter.newRepositorySystemSession(system);
Artifact jarArtifact = new DefaultArtifact("test", "demo", "", "jar", "0.1-SNAPSHOT");
jarArtifact = jarArtifact.setFile(new File("demo.jar"));
Artifact pomArtifact = new SubArtifact(jarArtifact, "", "pom");
pomArtifact = pomArtifact.setFile(new File("pom.xml"));
RemoteRepository distRepo = new RemoteRepository("demo", "default", new File("target/dist-repo").toURI().toString());
DeployRequest deployRequest = new DeployRequest();
deployRequest.addArtifact(jarArtifact).addArtifact(pomArtifact);
deployRequest.setRepository(distRepo);
system.deploy(session, deployRequest);
}
use of org.sonatype.aether.util.artifact.SubArtifact in project sonatype-aether by sonatype.
the class InstallArtifacts method main.
public static void main(String[] args) throws Exception {
System.out.println("------------------------------------------------------------");
System.out.println(InstallArtifacts.class.getSimpleName());
RepositorySystem system = Booter.newRepositorySystem();
RepositorySystemSession session = Booter.newRepositorySystemSession(system);
Artifact jarArtifact = new DefaultArtifact("test", "demo", "", "jar", "0.1-SNAPSHOT");
jarArtifact = jarArtifact.setFile(new File("demo.jar"));
Artifact pomArtifact = new SubArtifact(jarArtifact, "", "pom");
pomArtifact = pomArtifact.setFile(new File("pom.xml"));
InstallRequest installRequest = new InstallRequest();
installRequest.addArtifact(jarArtifact).addArtifact(pomArtifact);
system.install(session, installRequest);
}
use of org.sonatype.aether.util.artifact.SubArtifact 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.SubArtifact in project sonatype-aether by sonatype.
the class SubArtifactTest method testEmptyClassifier.
@Test
public void testEmptyClassifier() {
Artifact main = newMainArtifact("gid:aid:ext:cls:ver");
Artifact sub = new SubArtifact(main, "", "pom");
assertEquals("", sub.getClassifier());
sub = new SubArtifact(main, null, "pom");
assertEquals("", sub.getClassifier());
}
use of org.sonatype.aether.util.artifact.SubArtifact in project sonatype-aether by sonatype.
the class SubArtifactTest method testImmutability.
@Test
public void testImmutability() {
Artifact a = new SubArtifact(newMainArtifact("gid:aid:ver"), "", "pom");
assertNotSame(a, a.setFile(new File("file")));
assertNotSame(a, a.setVersion("otherVersion"));
assertNotSame(a, a.setProperties(Collections.singletonMap("key", "value")));
}
Aggregations