From 3996f56e8578885d9ea9a57e38775df8f3b61013 Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Mon, 20 Sep 2010 10:35:45 +0000 Subject: [PATCH] [MNG-4824] multiple failures need additional whitespace git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@998878 13f79535-47bb-0310-9956-ffa450edef68 --- .../exception/DefaultExceptionHandler.java | 4 ++-- .../java/org/apache/maven/cli/MavenCli.java | 23 ++++++++++++------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/maven-core/src/main/java/org/apache/maven/exception/DefaultExceptionHandler.java b/maven-core/src/main/java/org/apache/maven/exception/DefaultExceptionHandler.java index 27879db1b0..e6834e541b 100644 --- a/maven-core/src/main/java/org/apache/maven/exception/DefaultExceptionHandler.java +++ b/maven-core/src/main/java/org/apache/maven/exception/DefaultExceptionHandler.java @@ -139,8 +139,8 @@ public class DefaultExceptionHandler } String message = - "The project " + result.getProjectId() + " (" + result.getPomFile() + ") has " + children.size() + " error" - + ( children.size() == 1 ? "" : "s" ); + "\nThe project " + result.getProjectId() + " (" + result.getPomFile() + ") has " + + children.size() + " error" + ( children.size() == 1 ? "" : "s" ); return new ExceptionSummary( null, message, null, children ); } diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java index c10f5d5d8a..e2bd2dbfdf 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java @@ -526,7 +526,7 @@ public class MavenCli } } - String msg = indent + summary.getMessage(); + String msg = summary.getMessage(); if ( StringUtils.isNotEmpty( referenceKey ) ) { @@ -536,17 +536,24 @@ public class MavenCli } else { - msg += '\n' + indent + "-> " + referenceKey; + msg += "\n-> " + referenceKey; } } - if ( showErrors || ( summary.getException() instanceof InternalErrorException ) ) + String[] lines = msg.split( "(\r\n)|(\r)|(\n)" ); + + for ( int i = 0; i < lines.length; i++ ) { - logger.error( msg, summary.getException() ); - } - else - { - logger.error( msg ); + String line = indent + lines[i].trim(); + + if ( i == lines.length - 1 && ( showErrors || ( summary.getException() instanceof InternalErrorException ) ) ) + { + logger.error( line, summary.getException() ); + } + else + { + logger.error( line ); + } } indent += " ";