use of java.rmi.RemoteException in project intellij-community by JetBrains.
the class Maven30ServerEmbedderImpl method resolvePlugin.
@Override
public Collection<MavenArtifact> resolvePlugin(@NotNull final MavenPlugin plugin, @NotNull final List<MavenRemoteRepository> repositories, int nativeMavenProjectId, final boolean transitive) throws RemoteException, MavenServerProcessCanceledException {
try {
Plugin mavenPlugin = new Plugin();
mavenPlugin.setGroupId(plugin.getGroupId());
mavenPlugin.setArtifactId(plugin.getArtifactId());
mavenPlugin.setVersion(plugin.getVersion());
MavenProject project = RemoteNativeMavenProjectHolder.findProjectById(nativeMavenProjectId);
Plugin pluginFromProject = project.getBuild().getPluginsAsMap().get(plugin.getGroupId() + ':' + plugin.getArtifactId());
if (pluginFromProject != null) {
mavenPlugin.setDependencies(pluginFromProject.getDependencies());
}
final MavenExecutionRequest request = createRequest(null, Collections.<String>emptyList(), Collections.<String>emptyList(), Collections.<String>emptyList());
DefaultMaven maven = (DefaultMaven) getComponent(Maven.class);
RepositorySystemSession repositorySystemSession = maven.newRepositorySession(request);
PluginDependenciesResolver pluginDependenciesResolver = getComponent(PluginDependenciesResolver.class);
org.sonatype.aether.artifact.Artifact pluginArtifact = pluginDependenciesResolver.resolve(mavenPlugin, project.getRemotePluginRepositories(), repositorySystemSession);
org.sonatype.aether.graph.DependencyNode node = pluginDependenciesResolver.resolve(mavenPlugin, pluginArtifact, null, project.getRemotePluginRepositories(), repositorySystemSession);
PreorderNodeListGenerator nlg = new PreorderNodeListGenerator();
node.accept(nlg);
List<MavenArtifact> res = new ArrayList<MavenArtifact>();
for (org.sonatype.aether.artifact.Artifact artifact : nlg.getArtifacts(true)) {
if (!Comparing.equal(artifact.getArtifactId(), plugin.getArtifactId()) || !Comparing.equal(artifact.getGroupId(), plugin.getGroupId())) {
res.add(MavenModelConverter.convertArtifact(RepositoryUtils.toArtifact(artifact), getLocalRepositoryFile()));
}
}
return res;
} catch (Exception e) {
Maven3ServerGlobals.getLogger().info(e);
return Collections.emptyList();
}
}
use of java.rmi.RemoteException in project intellij-community by JetBrains.
the class Maven30ServerEmbedderImpl method reset.
@Override
public void reset() throws RemoteException {
try {
setConsoleAndIndicator(null, null);
final ArtifactFactory artifactFactory = getComponent(ArtifactFactory.class);
if (artifactFactory instanceof CustomMaven3ArtifactFactory) {
((CustomMaven3ArtifactFactory) artifactFactory).reset();
}
final ArtifactResolver artifactResolver = getComponent(ArtifactResolver.class);
if (artifactResolver instanceof CustomMaven30ArtifactResolver) {
((CustomMaven30ArtifactResolver) artifactResolver).reset();
}
final RepositoryMetadataManager repositoryMetadataManager = getComponent(RepositoryMetadataManager.class);
if (repositoryMetadataManager instanceof CustomMaven3RepositoryMetadataManager) {
((CustomMaven3RepositoryMetadataManager) repositoryMetadataManager).reset();
}
//((CustomWagonManager)getComponent(WagonManager.class)).reset();
} catch (Exception e) {
throw rethrowException(e);
}
}
use of java.rmi.RemoteException in project intellij-community by JetBrains.
the class TransferListenerAdapter method transferCompleted.
public void transferCompleted(TransferEvent event) {
try {
MavenServerDownloadListener listener = Maven2ServerGlobals.getDownloadListener();
if (listener != null)
listener.artifactDownloaded(event.getLocalFile(), event.getResource().getName());
} catch (RemoteException e) {
throw new RuntimeRemoteException(e);
}
checkCanceled();
String resourceName = event.getResource().getName();
DownloadData data = myDownloads.remove(resourceName);
data.finished = true;
updateProgress(resourceName, data);
}
use of java.rmi.RemoteException in project intellij-community by JetBrains.
the class Maven3ServerIndexerImpl method addArtifact.
@Override
public MavenId addArtifact(int indexId, File artifactFile) throws RemoteException, MavenServerIndexerException {
try {
IndexingContext index = getIndex(indexId);
ArtifactContext artifactContext = myArtifactContextProducer.getArtifactContext(index, artifactFile);
if (artifactContext == null)
return null;
addArtifact(myIndexer, index, artifactContext);
org.sonatype.nexus.index.ArtifactInfo a = artifactContext.getArtifactInfo();
return new MavenId(a.groupId, a.artifactId, a.version);
} catch (Exception e) {
throw new MavenServerIndexerException(wrapException(e));
}
}
use of java.rmi.RemoteException in project intellij-community by JetBrains.
the class Maven3ServerEmbedderImpl method resolveTransitively.
@NotNull
@Override
public List<MavenArtifact> resolveTransitively(@NotNull List<MavenArtifactInfo> artifacts, @NotNull List<MavenRemoteRepository> remoteRepositories) throws RemoteException, MavenServerProcessCanceledException {
try {
Set<Artifact> toResolve = new LinkedHashSet<Artifact>();
for (MavenArtifactInfo each : artifacts) {
toResolve.add(createArtifact(each));
}
Artifact project = getComponent(ArtifactFactory.class).createBuildArtifact("temp", "temp", "666", "pom");
Set<Artifact> res = getComponent(ArtifactResolver.class).resolveTransitively(toResolve, project, Collections.EMPTY_MAP, myLocalRepository, convertRepositories(remoteRepositories), getComponent(ArtifactMetadataSource.class)).getArtifacts();
return MavenModelConverter.convertArtifacts(res, new THashMap<Artifact, MavenArtifact>(), getLocalRepositoryFile());
} catch (ArtifactResolutionException e) {
Maven3ServerGlobals.getLogger().info(e);
} catch (ArtifactNotFoundException e) {
Maven3ServerGlobals.getLogger().info(e);
} catch (Exception e) {
throw rethrowException(e);
}
return Collections.emptyList();
}
Aggregations