From 61ba8778b6adf6f69a62bd4a515aafa2d9df27e2 Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Wed, 4 Nov 2009 12:51:58 +0000 Subject: [PATCH] [MNG-4426] No javac errors in console when error stacktraces are turned on git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@832729 13f79535-47bb-0310-9956-ffa450edef68 --- .../exception/DefaultExceptionHandler.java | 4 ++-- .../apache/maven/project/MavenProject.java | 1 - .../java/org/apache/maven/cli/MavenCli.java | 20 ++++++++++++++++--- 3 files changed, 19 insertions(+), 6 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 0001616ae7..48d8b404b2 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 @@ -212,9 +212,9 @@ public class DefaultExceptionHandler { exceptionMessage = longMessage; } - else + else if ( !exceptionMessage.contains( longMessage ) ) { - exceptionMessage = join( exceptionMessage, longMessage ); + exceptionMessage = join( exceptionMessage, '\n' + longMessage ); } } } diff --git a/maven-core/src/main/java/org/apache/maven/project/MavenProject.java b/maven-core/src/main/java/org/apache/maven/project/MavenProject.java index 7ed5f7cba3..1d8d68c867 100644 --- a/maven-core/src/main/java/org/apache/maven/project/MavenProject.java +++ b/maven-core/src/main/java/org/apache/maven/project/MavenProject.java @@ -235,7 +235,6 @@ public class MavenProject this.repositorySystem = repositorySystem; } - //TODO: need to integrate the effective scope and refactor it out of the MMS @Deprecated public Set createArtifacts( ArtifactFactory artifactFactory, String inheritedScope, ArtifactFilter filter ) throws InvalidDependencyVersionException 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 6dca9565c1..9a4eabecba 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 @@ -481,18 +481,32 @@ public class MavenCli referenceKey = references.get( summary.getReference() ); if ( referenceKey == null ) { - referenceKey = "[" + references.size() + "]"; + referenceKey = "[Help " + ( references.size() + 1 ) + "]"; references.put( summary.getReference(), referenceKey ); } } + String msg = indent + summary.getMessage(); + + if ( StringUtils.isNotEmpty( referenceKey ) ) + { + if ( msg.indexOf( '\n' ) < 0 ) + { + msg += " -> " + referenceKey; + } + else + { + msg += '\n' + indent + "-> " + referenceKey; + } + } + if ( showErrors ) { - logger.error( indent + referenceKey, summary.getException() ); + logger.error( msg, summary.getException() ); } else { - logger.error( indent + summary.getMessage() + " " + referenceKey ); + logger.error( msg ); } indent += " ";