slawekjaranowski commented on code in PR #1563: URL: https://github.com/apache/maven/pull/1563#discussion_r1628979345
########## maven-core/src/main/java/org/apache/maven/project/DefaultProjectDependenciesResolver.java: ########## @@ -160,7 +160,9 @@ public DependencyResolutionResult resolve(DependencyResolutionRequest request) result.setCollectionErrors(e.getResult().getExceptions()); throw new DependencyResolutionException( - result, "Could not resolve dependencies for project " + project.getId() + ": " + e.getMessage(), e); + result, + "Could not collect dependencies for project " + project.getId(), + logger.isDebugEnabled() ? e : null); Review Comment: When we have exception in stack all message from all exception will be added to output in normal run we will have some information duplicate now ########## maven-core/src/main/java/org/apache/maven/project/DependencyResolutionException.java: ########## @@ -18,18 +18,52 @@ */ package org.apache.maven.project; +import java.util.List; + +import org.eclipse.aether.graph.Dependency; + /** */ public class DependencyResolutionException extends Exception { private final transient DependencyResolutionResult result; + private final transient String detailMessage; public DependencyResolutionException(DependencyResolutionResult result, String message, Throwable cause) { super(message, cause); this.result = result; + this.detailMessage = prepareDetailMessage(message, result); + } + + private static String prepareDetailMessage(String message, DependencyResolutionResult result) { + StringBuilder msg = new StringBuilder(message); + msg.append(System.lineSeparator()); + for (Dependency dependency : result.getUnresolvedDependencies()) { + msg.append("dependency: ").append(dependency).append(System.lineSeparator()); + List<Exception> exceptions = result.getResolutionErrors(dependency); + for (Exception e : exceptions) { + msg.append("\t").append(e.getMessage()).append(System.lineSeparator()); + } + } + + for (Exception exception : result.getCollectionErrors()) { + msg.append(exception.getMessage()).append(System.lineSeparator()); + if (exception.getCause() != null) { + msg.append("\tCaused by: ") + .append(exception.getCause().getMessage()) Review Comment: right -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org