Search in sources :

Example 1 with DependencyTreeResolutionListener

use of org.apache.maven.shared.dependency.tree.DependencyTreeResolutionListener 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;
        }
    });
}
Also used : MavenExecutionResult(org.jetbrains.idea.maven.server.embedder.MavenExecutionResult) DependencyTreeResolutionListener(org.apache.maven.shared.dependency.tree.DependencyTreeResolutionListener) RemoteException(java.rmi.RemoteException) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with DependencyTreeResolutionListener

use of org.apache.maven.shared.dependency.tree.DependencyTreeResolutionListener in project intellij-community by JetBrains.

the class Maven3ServerEmbedderImpl method resolveProject.

@NotNull
@Override
public Collection<MavenServerExecutionResult> resolveProject(@NotNull 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;
        }
    });
}
Also used : MavenExecutionResult(org.jetbrains.idea.maven.server.embedder.MavenExecutionResult) DependencyTreeResolutionListener(org.apache.maven.shared.dependency.tree.DependencyTreeResolutionListener) RemoteException(java.rmi.RemoteException) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with DependencyTreeResolutionListener

use of org.apache.maven.shared.dependency.tree.DependencyTreeResolutionListener in project che by eclipse.

the class MavenServerImpl method resolveProject.

@Override
public MavenServerResult resolveProject(File pom, List<String> activeProfiles, List<String> inactiveProfiles) throws RemoteException {
    DependencyTreeResolutionListener listener = new DependencyTreeResolutionListener(terminalLogger);
    MavenResult mavenResult = internalResolveProject(pom, activeProfiles, inactiveProfiles, Collections.singletonList(listener));
    return createResult(pom, mavenResult);
}
Also used : DependencyTreeResolutionListener(org.apache.maven.shared.dependency.tree.DependencyTreeResolutionListener)

Example 4 with DependencyTreeResolutionListener

use of org.apache.maven.shared.dependency.tree.DependencyTreeResolutionListener in project intellij-community by JetBrains.

the class Maven2ServerEmbedderImpl method resolveProject.

@NotNull
public Collection<MavenServerExecutionResult> resolveProject(@NotNull final Collection<File> files, @NotNull final Collection<String> activeProfiles, @NotNull final Collection<String> inactiveProfiles) throws MavenServerProcessCanceledException, RemoteException {
    return ContainerUtil.mapNotNull(files, new Function<File, MavenServerExecutionResult>() {

        @Override
        public MavenServerExecutionResult fun(final File file) {
            try {
                return doExecute(new Executor<MavenServerExecutionResult>() {

                    public MavenServerExecutionResult execute() throws Exception {
                        DependencyTreeResolutionListener listener = new DependencyTreeResolutionListener(myConsoleWrapper);
                        MavenExecutionResult result = myImpl.resolveProject(file, new ArrayList<String>(activeProfiles), new ArrayList<String>(inactiveProfiles), Collections.<ResolutionListener>singletonList(listener));
                        return createExecutionResult(file, result, listener.getRootNode());
                    }
                });
            } catch (MavenServerProcessCanceledException e) {
                ExceptionUtil.rethrowAllAsUnchecked(e);
            } catch (RemoteException e) {
                ExceptionUtil.rethrowAllAsUnchecked(e);
            }
            return null;
        }
    });
}
Also used : MavenExecutionResult(org.jetbrains.maven.embedder.MavenExecutionResult) DependencyTreeResolutionListener(org.apache.maven.shared.dependency.tree.DependencyTreeResolutionListener) RemoteException(java.rmi.RemoteException) File(java.io.File) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

DependencyTreeResolutionListener (org.apache.maven.shared.dependency.tree.DependencyTreeResolutionListener)4 RemoteException (java.rmi.RemoteException)3 NotNull (org.jetbrains.annotations.NotNull)3 MavenExecutionResult (org.jetbrains.idea.maven.server.embedder.MavenExecutionResult)2 File (java.io.File)1 MavenExecutionResult (org.jetbrains.maven.embedder.MavenExecutionResult)1