MavenSession session = reflectiveCreateMavenSession(container, mvn, request);
LegacySupport legacy = container.lookup(LegacySupport.class);
legacy.setSession(session);
// then lookup the DefaultArtifactInstaller
DefaultArtifactInstaller dai = (DefaultArtifactInstaller) container.lookup(ArtifactInstaller.class);
final Set<Entry<String, InputStream>> entries = origins.entrySet();
for (Iterator<Entry<String, InputStream>> it = entries.iterator(); it.hasNext();) {
final Entry<String, InputStream> entry = it.next();
final String fileExtension = entry.getKey();
final InputStream in = entry.getValue();
File tmpFile = File.createTempFile("slingClipseTmp", fileExtension);
FileOutputStream fos = new FileOutputStream(tmpFile);
try {
IOUtils.copy(in, fos);
Artifact jarArtifact = new DefaultArtifact(groupId, artifactId, version, "", fileExtension, "",
new DefaultArtifactHandler());
dai.install(tmpFile, jarArtifact, maven.getLocalRepository());
} finally {
IOUtils.closeQuietly(in);
IOUtils.closeQuietly(fos);
FileUtils.deleteQuietly(tmpFile);
}