maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bentm...@apache.org
Subject svn commit: r788375 - in /maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin: DefaultPluginManager.java PluginConfigurationException.java PluginExecutionException.java
Date Thu, 25 Jun 2009 15:00:21 GMT
Author: bentmann
Date: Thu Jun 25 15:00:20 2009
New Revision: 788375

URL: http://svn.apache.org/viewvc?rev=788375&view=rev
Log:
o Improved error reporting

Modified:
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginConfigurationException.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginExecutionException.java

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java?rev=788375&r1=788374&r2=788375&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
(original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
Thu Jun 25 15:00:20 2009
@@ -509,8 +509,8 @@
             }
             catch ( ComponentLookupException e )
             {
-                throw new PluginContainerException( mojoDescriptor, pluginRealm, "Unable
to find the mojo '" + mojoDescriptor.getRoleHint() + "' in the plugin '" + pluginDescriptor.getPluginLookupKey()
-                    + "'", e );
+                throw new PluginContainerException( mojoDescriptor, pluginRealm, "Unable
to find the mojo '"
+                    + mojoDescriptor.getGoal() + "' in the plugin '" + pluginDescriptor.getId()
+ "'", e );
             }
     
             if ( mojo instanceof ContextEnabled )
@@ -598,6 +598,12 @@
         {
             throw new PluginConfigurationException( mojoDescriptor.getPluginDescriptor(),
"Unable to retrieve component configurator for plugin configuration", e );
         }
+        catch ( NoClassDefFoundError e )
+        {
+            throw new PluginConfigurationException( mojoDescriptor.getPluginDescriptor(),
+                                                    "A required class was missing during
mojo configuration: "
+                                                        + e.getMessage(), e );
+        }
         catch ( LinkageError e )
         {
             if ( logger.isFatalErrorEnabled() )

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginConfigurationException.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginConfigurationException.java?rev=788375&r1=788374&r2=788375&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginConfigurationException.java
(original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginConfigurationException.java
Thu Jun 25 15:00:20 2009
@@ -42,23 +42,30 @@
         this.originalMessage = originalMessage;
     }
 
+    public PluginConfigurationException( PluginDescriptor pluginDescriptor, String originalMessage,
Throwable cause )
+    {
+        super( originalMessage, cause );
+        this.pluginDescriptor = pluginDescriptor;
+        this.originalMessage = originalMessage;
+    }
+
     public PluginConfigurationException( PluginDescriptor pluginDescriptor, String originalMessage,
ExpressionEvaluationException cause )
     {
-        super( cause );
+        super( originalMessage, cause );
         this.pluginDescriptor = pluginDescriptor;
         this.originalMessage = originalMessage;
     }
 
     public PluginConfigurationException( PluginDescriptor pluginDescriptor, String originalMessage,
ComponentConfigurationException cause )
    {
-       super( cause );
+       super( originalMessage, cause );
        this.pluginDescriptor = pluginDescriptor;
        this.originalMessage = originalMessage;
    }
 
     public PluginConfigurationException( PluginDescriptor pluginDescriptor, String originalMessage,
ComponentLookupException cause )
    {
-       super( cause );
+       super( originalMessage, cause );
        this.pluginDescriptor = pluginDescriptor;
        this.originalMessage = originalMessage;
    }

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginExecutionException.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginExecutionException.java?rev=788375&r1=788374&r2=788375&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginExecutionException.java
(original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginExecutionException.java
Thu Jun 25 15:00:20 2009
@@ -17,13 +17,13 @@
 
     public PluginExecutionException( MojoExecution mojoExecution, MavenProject project, Exception
cause )
     {
-        super( mojoExecution.getMojoDescriptor(), project, "Mojo execution failed.", cause
);
+        super( mojoExecution.getMojoDescriptor(), project, constructMessage( cause ), cause
);
         this.mojoExecution = mojoExecution;
     }
 
     public PluginExecutionException( MojoExecution mojoExecution, MavenProject project, DuplicateArtifactAttachmentException
cause )
     {
-        super( mojoExecution.getMojoDescriptor(), project, "Mojo execution failed.", cause
);
+        super( mojoExecution.getMojoDescriptor(), project, constructMessage( cause ), cause
);
         this.mojoExecution = mojoExecution;
     }
 
@@ -31,4 +31,17 @@
     {
         return mojoExecution;
     }
+
+    private static String constructMessage( Throwable cause )
+    {
+        if ( cause != null )
+        {
+            return "Mojo execution failed: " + cause.getMessage();
+        }
+        else
+        {
+            return "Mojo execution failed.";
+        }
+    }
+
 }



Mime
View raw message