diff --git a/maven-core/src/main/java/org/apache/maven/BuildFailureException.java b/maven-core/src/main/java/org/apache/maven/BuildFailureException.java index 5aef0f2360..e81d6e5613 100644 --- a/maven-core/src/main/java/org/apache/maven/BuildFailureException.java +++ b/maven-core/src/main/java/org/apache/maven/BuildFailureException.java @@ -25,27 +25,13 @@ package org.apache.maven; public class BuildFailureException extends Exception { - private String longMessage; - public BuildFailureException( String message ) { super( message ); } - public BuildFailureException( String message, String longMessage ) - { - super( message ); - this.longMessage = longMessage; - } - - public BuildFailureException( String message, String longMessage, Throwable cause ) + public BuildFailureException( String message, Throwable cause ) { super( message, cause ); - this.longMessage = longMessage; - } - - public String getLongMessage() - { - return longMessage; } } diff --git a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java index 36d971b4c5..9f1061ec84 100644 --- a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java +++ b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java @@ -659,13 +659,6 @@ public class DefaultMaven logDiagnostics( e ); - if ( e.getLongMessage() != null ) - { - getLogger().info( e.getLongMessage() ); - - line(); - } - logTrace( e, showErrors ); if ( !showErrors ) diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java b/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java index 3fa333b82a..b97358dbaf 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java @@ -454,7 +454,7 @@ public class DefaultLifecycleExecutor } catch ( PluginNotFoundException e ) { - throw new BuildFailureException( "A required plugin was not found", e.getMessage(), e ); + throw new BuildFailureException( "A required plugin was not found: " + e.getMessage(), e ); } } @@ -537,7 +537,7 @@ public class DefaultLifecycleExecutor } catch ( MojoFailureException e ) { - throw new BuildFailureException( e.getMessage(), e.getLongMessage(), e ); + throw new BuildFailureException( e.getMessage(), e ); } catch ( MojoExecutionException e ) { diff --git a/maven-core/src/main/java/org/apache/maven/usability/MojoExecutionExceptionDiagnoser.java b/maven-core/src/main/java/org/apache/maven/usability/MojoExecutionExceptionDiagnoser.java index 9b87102a46..5eb2e32f12 100644 --- a/maven-core/src/main/java/org/apache/maven/usability/MojoExecutionExceptionDiagnoser.java +++ b/maven-core/src/main/java/org/apache/maven/usability/MojoExecutionExceptionDiagnoser.java @@ -36,39 +36,33 @@ public class MojoExecutionExceptionDiagnoser StringBuffer message = new StringBuffer(); - message.append( "Error executing mojo" ); - Object source = mee.getSource(); if ( source != null ) { message.append( ": " ).append( mee.getSource() ).append( "\n" ); } - else - { - message.append( ".\n" ); - } - message.append( "\n" ).append( mee.getMessage() ); + message.append( mee.getMessage() ); String longMessage = mee.getLongMessage(); if ( longMessage != null ) { message.append( "\n\n" ).append( longMessage ); } - + Throwable directCause = mee.getCause(); - + if ( directCause != null ) { message.append( "\n" ); - + String directCauseMessage = directCause.getMessage(); - + if ( directCauseMessage != null && mee.getMessage().indexOf( directCauseMessage ) < 0 ) { message.append( "\nEmbedded error: " ).append( directCauseMessage ); } - + DiagnosisUtils.appendRootCauseIfPresentAndUnique( directCause, message, false ); } diff --git a/maven-core/src/main/java/org/apache/maven/usability/MojoFailureExceptionDiagnoser.java b/maven-core/src/main/java/org/apache/maven/usability/MojoFailureExceptionDiagnoser.java index 629397123f..2b0a8b2005 100644 --- a/maven-core/src/main/java/org/apache/maven/usability/MojoFailureExceptionDiagnoser.java +++ b/maven-core/src/main/java/org/apache/maven/usability/MojoFailureExceptionDiagnoser.java @@ -26,7 +26,7 @@ public class MojoFailureExceptionDiagnoser public boolean canDiagnose( Throwable error ) { - return DiagnosisUtils.containsInCausality( error, MojoFailureExceptionDiagnoser.class ); + return DiagnosisUtils.containsInCausality( error, MojoFailureException.class ); } public String diagnose( Throwable error ) @@ -41,12 +41,8 @@ public class MojoFailureExceptionDiagnoser { message.append( ": " ).append( mfe.getSource() ).append( "\n" ); } - else - { - message.append( ".\n" ); - } - message.append( "\n" ).append( mfe.getMessage() ); + message.append( mfe.getMessage() ); String longMessage = mfe.getLongMessage(); if ( longMessage != null )