use of org.apache.maven.model.interpolation.ModelInterpolator in project intellij-community by JetBrains.
the class Maven3ServerEmbedder method getProjectBuildingResults.
@NotNull
protected List<ProjectBuildingResult> getProjectBuildingResults(@NotNull MavenExecutionRequest request, @NotNull Collection<File> files) {
final ProjectBuilder builder = getComponent(ProjectBuilder.class);
CustomMaven3ModelInterpolator2 modelInterpolator = (CustomMaven3ModelInterpolator2) getComponent(ModelInterpolator.class);
String savedLocalRepository = modelInterpolator.getLocalRepository();
modelInterpolator.setLocalRepository(request.getLocalRepositoryPath().getAbsolutePath());
List<ProjectBuildingResult> buildingResults = new SmartList<ProjectBuildingResult>();
final 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<File>(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 {
modelInterpolator.setLocalRepository(savedLocalRepository);
}
return buildingResults;
}
Aggregations