use of java.rmi.RemoteException in project intellij-community by JetBrains.
the class Maven30ServerEmbedderImpl method resolveProject.
@NotNull
@Override
public Collection<MavenServerExecutionResult> resolveProject(@NotNull final Collection<File> files, @NotNull Collection<String> activeProfiles, @NotNull Collection<String> inactiveProfiles) throws RemoteException, MavenServerProcessCanceledException {
final DependencyTreeResolutionListener listener = new DependencyTreeResolutionListener(myConsoleWrapper);
Collection<MavenExecutionResult> results = doResolveProject(files, new ArrayList<String>(activeProfiles), new ArrayList<String>(inactiveProfiles), Collections.<ResolutionListener>singletonList(listener));
return ContainerUtil.mapNotNull(results, new Function<MavenExecutionResult, MavenServerExecutionResult>() {
@Override
public MavenServerExecutionResult fun(MavenExecutionResult result) {
try {
return createExecutionResult(result.getPomFile(), result, listener.getRootNode());
} catch (RemoteException e) {
ExceptionUtil.rethrowAllAsUnchecked(e);
}
return null;
}
});
}
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));
}
}
Aggregations