Collection<Maven3ExecutionResult> (@NotNull LongRunningTask task, @NotNull Collection<File> files, @NotNull List<String> activeProfiles, @NotNull List<String> inactiveProfiles, List<ResolutionListener> listeners) { File file = !files.isEmpty() ? files.iterator().next() : null; files.forEach(f -> MavenServerStatsCollector.fileRead(f)); MavenExecutionRequest request = myEmbedder.createRequest(file, activeProfiles, inactiveProfiles, userProperties); request.setUpdateSnapshots(myUpdateSnapshots); Collection<Maven3ExecutionResult> executionResults = new ArrayList<>(); Map<ProjectBuildingResult, List<Exception>> buildingResultsToResolveDependencies = new HashMap<>(); myEmbedder.executeWithMavenSession(request, () -> { try { MavenSession mavenSession = myEmbedder.getComponent(LegacySupport.class).getSession(); RepositorySystemSession repositorySession = myEmbedder.getComponent(LegacySupport.class).getRepositorySession(); if (repositorySession instanceof DefaultRepositorySystemSession) { DefaultRepositorySystemSession session = (DefaultRepositorySystemSession)repositorySession; myImporterSpy.setIndicator(myCurrentIndicator); session.setTransferListener(new Maven3TransferListenerAdapter(myCurrentIndicator)); if (myWorkspaceMap != null) { session.setWorkspaceReader(new Maven3WorkspaceMapReader(myWorkspaceMap)); } session.setConfigProperty(ConflictResolver.CONFIG_PROP_VERBOSE, true); session.setConfigProperty(DependencyManagerUtils.CONFIG_PROP_VERBOSE, true); } List<ProjectBuildingResult> buildingResults = getProjectBuildingResults(request, files); fillSessionCache(mavenSession, repositorySession, buildingResults); boolean addUnresolved = System.getProperty("idea.maven.no.use.dependency.graph") == null; for (ProjectBuildingResult buildingResult : buildingResults) { MavenProject project = buildingResult.getProject(); if (project == null) { List<Exception> exceptions = new ArrayList<>(); for (ModelProblem problem : buildingResult.getProblems()) { exceptions.add(problem.getException()); } executionResults.add(new Maven3ExecutionResult(buildingResult.getPomFile(), exceptions)); continue; } List<Exception> exceptions = new ArrayList<>(); loadExtensions(project, exceptions); project.setDependencyArtifacts(project.createArtifacts(myEmbedder.getComponent(ArtifactFactory.class), null, null)); if (USE_MVN2_COMPATIBLE_DEPENDENCY_RESOLVING) { executionResults.add(resolveMvn2CompatResult(project, exceptions, listeners, myLocalRepository)); } else { buildingResultsToResolveDependencies.put(buildingResult, exceptions); } } task.updateTotalRequests(buildingResultsToResolveDependencies.size()); boolean runInParallel = myResolveInParallel; Collection<Maven3ExecutionResult> execResults = ParallelRunner.execute( runInParallel, buildingResultsToResolveDependencies.entrySet(), entry -> { if (task.isCanceled()) return new Maven3ExecutionResult(Collections.emptyList()); Maven3ExecutionResult result = resolveBuildingResult(repositorySession, addUnresolved, entry.getKey(), entry.getValue()); task.incrementFinishedRequests(); return result; } ); executionResults.addAll(execResults); } catch (Exception e) { executionResults.add(handleException(e)); } }); return executionResults; }