private ExceptionSummary handle( String message, Throwable exception ) { String reference = getReference( exception ); List<ExceptionSummary> children = null; if ( exception instanceof ProjectBuildingException ) { List<ProjectBuildingResult> results = ( (ProjectBuildingException) exception ).getResults(); children = new ArrayList<>(); for ( ProjectBuildingResult result : results ) { ExceptionSummary child = handle( result ); if ( child != null ) { children.add( child ); } } message = "The build could not read " + children.size() + " project" + ( children.size() == 1 ? "" : "s" ); } else { message = getMessage( message, exception ); } return new ExceptionSummary( exception, message, reference, children ); }
public MavenExecutionResult readMavenProject(File pomFile, ProjectBuildingRequest configuration) throws MavenException { long start = System.currentTimeMillis(); log.debug("Reading Maven project: {}", pomFile.getAbsoluteFile()); //$NON-NLS-1$ MavenExecutionResult result = new DefaultMavenExecutionResult(); try { configuration.setValidationLevel(ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL); ProjectBuildingResult projectBuildingResult = lookup(ProjectBuilder.class).build(pomFile, configuration); result.setProject(projectBuildingResult.getProject()); result.setDependencyResolutionResult(projectBuildingResult.getDependencyResolutionResult()); } catch (ProjectBuildingException ex) { if (ex.getResults() != null && ex.getResults().size() == 1) { ProjectBuildingResult projectBuildingResult = ex.getResults().get(0); result.setProject(projectBuildingResult.getProject()); result.setDependencyResolutionResult(projectBuildingResult.getDependencyResolutionResult()); } result.addException(ex); } catch (RuntimeException e) { result.addException(e); } finally { log.debug("Read Maven project: {} in {} ms", pomFile.getAbsoluteFile(), System.currentTimeMillis() - start); //$NON-NLS-1$ } return result; }
final List<ProjectBuildingResult> results = e.getResults();
final List<ProjectBuildingResult> results = e.getResults();
final List<ProjectBuildingResult> results = e.getResults();
List<ProjectBuildingResult> results = pbe.getResults(); if (results != null && results.size() > 0) result = results.get(0);