MavenServerExecutionResult (@Nullable File file, Maven3ExecutionResult result, DependencyNode rootNode) { Collection<MavenProjectProblem> problems = MavenProjectProblem.createProblemsList(); myEmbedder.collectProblems(file, result.getExceptions(), result.getModelProblems(), problems); Collection<MavenProjectProblem> unresolvedProblems = new HashSet<>(); collectUnresolvedArtifactProblems(file, result.getDependencyResolutionResult(), unresolvedProblems); MavenProject mavenProject = result.getMavenProject(); if (mavenProject == null) return new MavenServerExecutionResult(null, problems, Collections.emptySet()); MavenModel model = new MavenModel(); try { if (USE_MVN2_COMPATIBLE_DEPENDENCY_RESOLVING) { //noinspection unchecked List<DependencyNode> dependencyNodes = rootNode == null ? Collections.emptyList() : rootNode.getChildren(); model = Maven3ModelConverter.convertModel( mavenProject.getModel(), mavenProject.getCompileSourceRoots(), mavenProject.getTestCompileSourceRoots(), mavenProject.getArtifacts(), dependencyNodes, mavenProject.getExtensionArtifacts(), myEmbedder.getLocalRepositoryFile()); } else { DependencyResolutionResult dependencyResolutionResult = result.getDependencyResolutionResult(); org.eclipse.aether.graph.DependencyNode dependencyGraph = dependencyResolutionResult != null ? dependencyResolutionResult.getDependencyGraph() : null; List<org.eclipse.aether.graph.DependencyNode> dependencyNodes = dependencyGraph != null ? dependencyGraph.getChildren() : Collections.emptyList(); model = Maven3AetherModelConverter.convertModelWithAetherDependencyTree( mavenProject.getModel(), mavenProject.getCompileSourceRoots(), mavenProject.getTestCompileSourceRoots(), mavenProject.getArtifacts(), dependencyNodes, mavenProject.getExtensionArtifacts(), myEmbedder.getLocalRepositoryFile()); } } catch (Exception e) { myEmbedder.collectProblems(mavenProject.getFile(), Collections.singleton(e), result.getModelProblems(), problems); } RemoteNativeMaven3ProjectHolder holder = new RemoteNativeMaven3ProjectHolder(mavenProject); try { UnicastRemoteObject.exportObject(holder, 0); } catch (RemoteException e) { throw new RuntimeException(e); } Collection<String> activatedProfiles = Maven3XProfileUtil.collectActivatedProfiles(mavenProject); Map<String, String> mavenModelMap = Maven3ModelConverter.convertToMap(mavenProject.getModel()); MavenServerExecutionResult.ProjectData data = new MavenServerExecutionResult.ProjectData(model, mavenModelMap, holder, activatedProfiles); return new MavenServerExecutionResult(data, problems, Collections.emptySet(), unresolvedProblems); }