From ac64dd6bb6096e8dbd54e3520208e5737fb1c804 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Thu, 30 May 2013 03:10:51 +0200 Subject: [PATCH] [MNG-5482] detect missing Sonatype Aether classes to give a hint to AetherClassNotFound Wiki article --- .../exception/DefaultExceptionHandler.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) 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 6066593f7b..5452fdf34d 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 @@ -31,6 +31,7 @@ import org.apache.maven.model.building.ModelProblemUtils; import org.apache.maven.plugin.AbstractMojoExecutionException; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugin.PluginContainerException; import org.apache.maven.plugin.PluginExecutionException; import org.apache.maven.project.ProjectBuildingException; import org.apache.maven.project.ProjectBuildingResult; @@ -198,7 +199,23 @@ public class DefaultExceptionHandler } else if ( exception instanceof PluginExecutionException ) { - reference = getReference( exception.getCause() ); + Throwable cause = exception.getCause(); + + if ( cause instanceof PluginContainerException ) + { + Throwable cause2 = cause.getCause(); + + if ( cause2 instanceof NoClassDefFoundError + && cause2.getMessage().contains( "org/sonatype/aether/" ) ) + { + reference = "AetherClassNotFound"; + } + } + + if ( StringUtils.isEmpty( reference ) ) + { + reference = getReference( cause ); + } if ( StringUtils.isEmpty( reference ) ) {