Search in sources :

Example 1 with InstallRequest

use of org.eclipse.aether.installation.InstallRequest in project unleash-maven-plugin by shillner.

the class ArtifactInstaller method installArtifacts.

/**
 * Installs the given artifacts into the local Maven repository.
 *
 * @param artifacts the artifacts to install.
 * @return the artifacts that have been installed successfully.
 * @throws InstallationException if anything goes wrong during the installation process.
 */
public Collection<Artifact> installArtifacts(Collection<Artifact> artifacts) throws InstallationException {
    InstallRequest request = new InstallRequest();
    request.setArtifacts(artifacts);
    InstallResult result = this.installer.install(this.repoSession, request);
    return result.getArtifacts();
}
Also used : InstallRequest(org.eclipse.aether.installation.InstallRequest) InstallResult(org.eclipse.aether.installation.InstallResult)

Example 2 with InstallRequest

use of org.eclipse.aether.installation.InstallRequest in project ceylon by eclipse.

the class Bug2414 method bug.

public static void bug(Artifact jarArtifact) {
    // locator.getService(RepositorySystem.class);
    final RepositorySystem system = null;
    // MavenRepositorySystemUtils.newSession();
    final DefaultRepositorySystemSession session = null;
    ModuleCopycat copycat = new ModuleCopycat(rmb.buildManager(), new RepositoryManager() {

        @Override
        public void putArtifact(ArtifactContext artifactContext, File file) throws RepositoryException {
            try {
                InstallRequest installRequest = new InstallRequest();
                installRequest.addArtifact(jarArtifact);
                InstallResult result = system.install(session, installRequest);
            } catch (InstallationException e) {
                throw new RepositoryException(e);
            }
        }
    });
}
Also used : RepositorySystem(org.eclipse.aether.RepositorySystem) DefaultRepositorySystemSession(org.eclipse.aether.DefaultRepositorySystemSession) InstallRequest(org.eclipse.aether.installation.InstallRequest) InstallationException(org.eclipse.aether.installation.InstallationException) RepositoryException(org.eclipse.ceylon.model.cmr.RepositoryException) ModuleCopycat(org.eclipse.ceylon.cmr.ceylon.ModuleCopycat) InstallResult(org.eclipse.aether.installation.InstallResult)

Example 3 with InstallRequest

use of org.eclipse.aether.installation.InstallRequest in project kie-wb-common by kiegroup.

the class MavenDependencyConfigExecutorTest method installArtifactLocally.

private void installArtifactLocally(final String groupId, final String artifactId, final String version) throws Exception {
    Artifact pomArtifact = new DefaultArtifact(groupId, artifactId, "pom", version);
    final Path pom = getPom(groupId, artifactId, version);
    pomArtifact = pomArtifact.setFile(pom.toFile());
    final InstallRequest installRequest = new InstallRequest();
    installRequest.addArtifact(pomArtifact);
    final DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
    RepositorySystem system = locator.getService(RepositorySystem.class);
    final DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
    final LocalRepository localRepo = new LocalRepository(m2Folder);
    session.setLocalRepositoryManager(system.newLocalRepositoryManager(session, localRepo));
    system.install(session, installRequest);
}
Also used : Path(java.nio.file.Path) RepositorySystem(org.eclipse.aether.RepositorySystem) DefaultRepositorySystemSession(org.eclipse.aether.DefaultRepositorySystemSession) InstallRequest(org.eclipse.aether.installation.InstallRequest) LocalRepository(org.eclipse.aether.repository.LocalRepository) DefaultServiceLocator(org.eclipse.aether.impl.DefaultServiceLocator) DefaultArtifact(org.eclipse.aether.artifact.DefaultArtifact) Artifact(org.eclipse.aether.artifact.Artifact) DefaultArtifact(org.eclipse.aether.artifact.DefaultArtifact)

Aggregations

InstallRequest (org.eclipse.aether.installation.InstallRequest)3 DefaultRepositorySystemSession (org.eclipse.aether.DefaultRepositorySystemSession)2 RepositorySystem (org.eclipse.aether.RepositorySystem)2 InstallResult (org.eclipse.aether.installation.InstallResult)2 Path (java.nio.file.Path)1 Artifact (org.eclipse.aether.artifact.Artifact)1 DefaultArtifact (org.eclipse.aether.artifact.DefaultArtifact)1 DefaultServiceLocator (org.eclipse.aether.impl.DefaultServiceLocator)1 InstallationException (org.eclipse.aether.installation.InstallationException)1 LocalRepository (org.eclipse.aether.repository.LocalRepository)1 ModuleCopycat (org.eclipse.ceylon.cmr.ceylon.ModuleCopycat)1 RepositoryException (org.eclipse.ceylon.model.cmr.RepositoryException)1