List<ProjectBuildingResult> (@NotNull MavenExecutionRequest request, @NotNull Collection<File> files) { ProjectBuilder builder = myEmbedder.getComponent(ProjectBuilder.class); ModelInterpolator modelInterpolator = myEmbedder.getComponent(ModelInterpolator.class); String savedLocalRepository = null; if (modelInterpolator instanceof CustomMaven3ModelInterpolator2) { CustomMaven3ModelInterpolator2 customMaven3ModelInterpolator2 = (CustomMaven3ModelInterpolator2)modelInterpolator; savedLocalRepository = customMaven3ModelInterpolator2.getLocalRepository(); customMaven3ModelInterpolator2.setLocalRepository(request.getLocalRepositoryPath().getAbsolutePath()); } List<ProjectBuildingResult> buildingResults = new ArrayList<>(); ProjectBuildingRequest projectBuildingRequest = request.getProjectBuildingRequest(); projectBuildingRequest.setValidationLevel(ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL); projectBuildingRequest.setResolveDependencies(false); try { if (files.size() == 1) { buildSinglePom(builder, buildingResults, projectBuildingRequest, files.iterator().next()); } else { try { buildingResults = builder.build(new ArrayList<>(files), false, projectBuildingRequest); } catch (ProjectBuildingException e) { for (ProjectBuildingResult result : e.getResults()) { if (result.getProject() != null) { buildingResults.add(result); } else { buildSinglePom(builder, buildingResults, projectBuildingRequest, result.getPomFile()); } } } } } finally { if (modelInterpolator instanceof CustomMaven3ModelInterpolator2 && savedLocalRepository != null) { ((CustomMaven3ModelInterpolator2)modelInterpolator).setLocalRepository(savedLocalRepository); } } return buildingResults; }