Example usage for org.apache.maven.project DependencyResolutionResult getCollectionErrors

List of usage examples for org.apache.maven.project DependencyResolutionResult getCollectionErrors

Introduction

In this page you can find the example usage for org.apache.maven.project DependencyResolutionResult getCollectionErrors.

Prototype

List<Exception> getCollectionErrors();

Source Link

Document

Gets the errors that occurred while building the dependency graph.

Usage

From source file:org.eclipse.m2e.core.internal.markers.MavenMarkerManager.java

License:Open Source License

public void addMarkers(IResource pomResource, String type, MavenExecutionResult result) {
    SourceLocation defaultSourceLocation = new SourceLocation(1, 0, 0);
    List<MavenProblemInfo> allProblems = new ArrayList<MavenProblemInfo>();

    allProblems.addAll(toMavenProblemInfos(pomResource, defaultSourceLocation, result.getExceptions()));

    MavenProject mavenProject = result.getProject();
    DependencyResolutionResult resolutionResult = result.getDependencyResolutionResult();
    if (resolutionResult != null) {
        allProblems.addAll(toMavenProblemInfos(pomResource, defaultSourceLocation,
                resolutionResult.getCollectionErrors()));
        for (org.sonatype.aether.graph.Dependency dependency : resolutionResult.getUnresolvedDependencies()) {
            List<Exception> exceptions = resolutionResult.getResolutionErrors(dependency);
            if (exceptions != null && exceptions.size() > 0) {
                SourceLocation sourceLocation = SourceLocationHelper.findLocation(mavenProject, dependency);
                allProblems.addAll(toMavenProblemInfos(pomResource, sourceLocation, exceptions));
            }/*from  w w w  . j a  v  a2  s .c o m*/
        }
    }

    if (mavenProject != null) {
        addMissingArtifactProblemInfos(mavenProject, defaultSourceLocation, allProblems);
    }

    addErrorMarkers(pomResource, type, allProblems);
}