Search in sources :

Example 1 with MavenExecutionResult

use of org.jetbrains.maven.embedder.MavenExecutionResult 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

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