private ArtifactResolutionResult validateResolutionResult()

in gshell-support/gshell-artifact-maven/src/main/java/org/apache/geronimo/gshell/artifact/maven/ArtifactManagerImpl.java [117:187]


    private ArtifactResolutionResult validateResolutionResult(final ArtifactResolutionRequest request, final ArtifactResolutionResult result) throws ResolutionException {
        assert request != null;
        assert result != null;

        log.debug("Validating result: {}", result);

        boolean failed = false;

        if (result.hasErrorArtifactExceptions()) {
            failed = true;

            log.error("Artifact resolution errors:");
            List<ArtifactResolutionException> exceptions = result.getErrorArtifactExceptions();
            for (ArtifactResolutionException exception : exceptions) {
                log.error("    {}", exception);
                log.trace("Artifact resolution error", exception);
            }
        }

        if (result.hasCircularDependencyExceptions()) {
            failed = true;

            log.error("Artifact circular dependency errors:");
            List<CyclicDependencyException> exceptions = result.getCircularDependencyExceptions();
            for (CyclicDependencyException exception : exceptions) {
                log.error("    {}", exception);
                log.trace("Artifact circular dependency error", exception);
            }
        }

        if (result.hasMetadataResolutionExceptions()) {
            failed = true;

            log.error("Artifact metadata resolution errors:");
            // noinspection unchecked
            List<ArtifactResolutionException> exceptions = result.getMetadataResolutionExceptions();
            for (ArtifactResolutionException exception : exceptions) {
                log.error("    {}", exception);
                log.trace("Artifact metadata resolution error", exception);
            }
        }

        if (result.hasVersionRangeViolations()) {
            failed = true;

            log.error("Artifact version range violations:");
            // noinspection unchecked
            List<Exception> exceptions = result.getVersionRangeViolations();
            for (Exception exception : exceptions) {
                log.error("    {}", exception);
                log.trace("Artifact version range violation", exception);
            }
        }

        // noinspection unchecked
        List<Artifact> artifacts = result.getMissingArtifacts();
        if (!artifacts.isEmpty()) {
            failed = true;

            log.error("Missing artifacts:");
            for (Artifact artifact : artifacts) {
                log.error("    {}", artifact);
            }
        }

        if (failed) {
            throw new ResolutionException(request, result);
        }
        
        return result;
    }