Search in sources :

Example 1 with InstallRequest

use of org.sonatype.aether.installation.InstallRequest in project gradle by gradle.

the class MavenInstallAction method publishArtifacts.

@Override
protected void publishArtifacts(Collection<Artifact> artifacts, RepositorySystem repositorySystem, RepositorySystemSession session) throws InstallationException {
    InstallRequest request = new InstallRequest();
    for (Artifact artifact : artifacts) {
        request.addArtifact(artifact);
    }
    repositorySystem.install(session, request);
}
Also used : InstallRequest(org.sonatype.aether.installation.InstallRequest) Artifact(org.sonatype.aether.artifact.Artifact)

Example 2 with InstallRequest

use of org.sonatype.aether.installation.InstallRequest in project sonatype-aether by sonatype.

the class DefaultInstallerTest method testNullMetadataFile.

@Test(expected = InstallationException.class)
public void testNullMetadataFile() throws InstallationException {
    InstallRequest request = new InstallRequest();
    request.addMetadata(metadata.setFile(null));
    installer.install(session, request);
}
Also used : InstallRequest(org.sonatype.aether.installation.InstallRequest) Test(org.junit.Test)

Example 3 with InstallRequest

use of org.sonatype.aether.installation.InstallRequest in project sonatype-aether by sonatype.

the class DefaultInstallerTest method testSuccessfulArtifactEvents.

@Test
public void testSuccessfulArtifactEvents() throws InstallationException {
    InstallRequest request = new InstallRequest();
    request.addArtifact(artifact);
    installer.install(session, request);
    checkEvents("Repository Event problem", artifact, false);
}
Also used : InstallRequest(org.sonatype.aether.installation.InstallRequest) Test(org.junit.Test)

Example 4 with InstallRequest

use of org.sonatype.aether.installation.InstallRequest in project sonatype-aether by sonatype.

the class Aether method install.

public void install(Artifact artifact, Artifact pom) throws InstallationException {
    RepositorySystemSession session = newSession();
    InstallRequest installRequest = new InstallRequest();
    installRequest.addArtifact(artifact).addArtifact(pom);
    repositorySystem.install(session, installRequest);
}
Also used : MavenRepositorySystemSession(org.apache.maven.repository.internal.MavenRepositorySystemSession) RepositorySystemSession(org.sonatype.aether.RepositorySystemSession) InstallRequest(org.sonatype.aether.installation.InstallRequest)

Example 5 with InstallRequest

use of org.sonatype.aether.installation.InstallRequest 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);
}
Also used : RepositorySystem(org.sonatype.aether.RepositorySystem) RepositorySystemSession(org.sonatype.aether.RepositorySystemSession) InstallRequest(org.sonatype.aether.installation.InstallRequest) SubArtifact(org.sonatype.aether.util.artifact.SubArtifact) File(java.io.File) Artifact(org.sonatype.aether.artifact.Artifact) DefaultArtifact(org.sonatype.aether.util.artifact.DefaultArtifact) SubArtifact(org.sonatype.aether.util.artifact.SubArtifact) DefaultArtifact(org.sonatype.aether.util.artifact.DefaultArtifact)

Aggregations

InstallRequest (org.sonatype.aether.installation.InstallRequest)12 Test (org.junit.Test)6 File (java.io.File)3 RepositorySystemSession (org.sonatype.aether.RepositorySystemSession)2 Artifact (org.sonatype.aether.artifact.Artifact)2 InstallationException (org.sonatype.aether.installation.InstallationException)2 DefaultArtifact (org.sonatype.aether.util.artifact.DefaultArtifact)2 IOException (java.io.IOException)1 MavenRepositorySystemSession (org.apache.maven.repository.internal.MavenRepositorySystemSession)1 Before (org.junit.Before)1 RepositorySystem (org.sonatype.aether.RepositorySystem)1 RecordingRepositoryListener (org.sonatype.aether.test.impl.RecordingRepositoryListener)1 TestRepositorySystemSession (org.sonatype.aether.test.impl.TestRepositorySystemSession)1 SubArtifact (org.sonatype.aether.util.artifact.SubArtifact)1 DefaultMetadata (org.sonatype.aether.util.metadata.DefaultMetadata)1