Search in sources :

Example 1 with InstallationException

use of org.eclipse.aether.installation.InstallationException 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 2 with InstallationException

use of org.eclipse.aether.installation.InstallationException in project drools by kiegroup.

the class MavenRepository method installArtifact.

/**
 * Installs the given jar into the local repository.
 *
 * @param releaseId The releaseId with which the kjar will be installed
 * @param jar The jar to be installed
 * @param pomfile The pom file to be installed together with the kjar
 */
public void installArtifact(ReleaseId releaseId, File jar, File pomfile) {
    Artifact jarArtifact = new DefaultArtifact(releaseId.getGroupId(), releaseId.getArtifactId(), "jar", releaseId.getVersion());
    jarArtifact = jarArtifact.setFile(jar);
    Artifact pomArtifact = new SubArtifact(jarArtifact, "", "pom");
    pomArtifact = pomArtifact.setFile(pomfile);
    InstallRequest installRequest = new InstallRequest();
    installRequest.addArtifact(jarArtifact).addArtifact(pomArtifact);
    try {
        aether.getSystem().install(aether.getSession(), installRequest);
    } catch (InstallationException e) {
        throw new RuntimeException(e);
    }
}
Also used : InstallRequest(org.eclipse.aether.installation.InstallRequest) InstallationException(org.eclipse.aether.installation.InstallationException) SubArtifact(org.eclipse.aether.util.artifact.SubArtifact) SubArtifact(org.eclipse.aether.util.artifact.SubArtifact) 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)2 InstallationException (org.eclipse.aether.installation.InstallationException)2 DefaultRepositorySystemSession (org.eclipse.aether.DefaultRepositorySystemSession)1 RepositorySystem (org.eclipse.aether.RepositorySystem)1 Artifact (org.eclipse.aether.artifact.Artifact)1 DefaultArtifact (org.eclipse.aether.artifact.DefaultArtifact)1 InstallResult (org.eclipse.aether.installation.InstallResult)1 SubArtifact (org.eclipse.aether.util.artifact.SubArtifact)1 ModuleCopycat (org.eclipse.ceylon.cmr.ceylon.ModuleCopycat)1 RepositoryException (org.eclipse.ceylon.model.cmr.RepositoryException)1