Author: brett
Date: Mon Sep 26 07:40:17 2005
New Revision: 291632

URL: http://svn.apache.org/viewcvs?rev=291632&view=rev
Log:
allow both error and failure exceptions from mojos instead of just checking for 
a null cause

Added:
    
maven/components/trunk/maven-plugin-api/src/main/java/org/apache/maven/plugin/AbstractMojoExecutionException.java
   (with props)
    
maven/components/trunk/maven-plugin-api/src/main/java/org/apache/maven/plugin/MojoFailureException.java
   (with props)
Modified:
    
maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
    
maven/components/trunk/maven-plugin-api/src/main/java/org/apache/maven/plugin/MojoExecutionException.java

Modified: 
maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
URL: 
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java?rev=291632&r1=291631&r2=291632&view=diff
==============================================================================
--- 
maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
 (original)
+++ 
maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
 Mon Sep 26 07:40:17 2005
@@ -232,8 +232,15 @@
                             writeReactorSummary( rm );
                         }
                     }
+                    else if ( exception instanceof MojoFailureException )
+                    {
+                        MojoFailureException e = (MojoFailureException) 
exception;
+
+                        logFailure( response, e, e.getLongMessage() );
+                    }
                     else if ( exception instanceof MojoExecutionException )
                     {
+                        // TODO: replace by above
                         if ( exception.getCause() == null )
                         {
                             MojoExecutionException e = 
(MojoExecutionException) exception;

Added: 
maven/components/trunk/maven-plugin-api/src/main/java/org/apache/maven/plugin/AbstractMojoExecutionException.java
URL: 
http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-api/src/main/java/org/apache/maven/plugin/AbstractMojoExecutionException.java?rev=291632&view=auto
==============================================================================
--- 
maven/components/trunk/maven-plugin-api/src/main/java/org/apache/maven/plugin/AbstractMojoExecutionException.java
 (added)
+++ 
maven/components/trunk/maven-plugin-api/src/main/java/org/apache/maven/plugin/AbstractMojoExecutionException.java
 Mon Sep 26 07:40:17 2005
@@ -0,0 +1,51 @@
+package org.apache.maven.plugin;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Base exception.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Brett Porter</a>
+ * @version $Id$
+ */
+public abstract class AbstractMojoExecutionException
+    extends Exception
+{
+    protected Object source;
+
+    protected String longMessage;
+
+    public AbstractMojoExecutionException( String message )
+    {
+        super( message );
+    }
+
+    public AbstractMojoExecutionException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+
+    public String getLongMessage()
+    {
+        return longMessage;
+    }
+
+    public Object getSource()
+    {
+        return source;
+    }
+}

Propchange: 
maven/components/trunk/maven-plugin-api/src/main/java/org/apache/maven/plugin/AbstractMojoExecutionException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/components/trunk/maven-plugin-api/src/main/java/org/apache/maven/plugin/AbstractMojoExecutionException.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: 
maven/components/trunk/maven-plugin-api/src/main/java/org/apache/maven/plugin/MojoExecutionException.java
URL: 
http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-api/src/main/java/org/apache/maven/plugin/MojoExecutionException.java?rev=291632&r1=291631&r2=291632&view=diff
==============================================================================
--- 
maven/components/trunk/maven-plugin-api/src/main/java/org/apache/maven/plugin/MojoExecutionException.java
 (original)
+++ 
maven/components/trunk/maven-plugin-api/src/main/java/org/apache/maven/plugin/MojoExecutionException.java
 Mon Sep 26 07:40:17 2005
@@ -17,18 +17,14 @@
  */
 
 /**
- * A failure or exception occuring during the execution of a plugin.
+ * An exception occuring during the execution of a plugin.
  *
  * @author Brett Porter
  * @version $Id$
  */
 public class MojoExecutionException
-    extends Exception
+    extends AbstractMojoExecutionException
 {
-    private Object source;
-
-    private String longMessage;
-
     public MojoExecutionException( Object source, String shortMessage, String 
longMessage )
     {
         super( shortMessage );
@@ -51,13 +47,4 @@
         super( message );
     }
 
-    public String getLongMessage()
-    {
-        return longMessage;
-    }
-
-    public Object getSource()
-    {
-        return source;
-    }
 }

Added: 
maven/components/trunk/maven-plugin-api/src/main/java/org/apache/maven/plugin/MojoFailureException.java
URL: 
http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-api/src/main/java/org/apache/maven/plugin/MojoFailureException.java?rev=291632&view=auto
==============================================================================
--- 
maven/components/trunk/maven-plugin-api/src/main/java/org/apache/maven/plugin/MojoFailureException.java
 (added)
+++ 
maven/components/trunk/maven-plugin-api/src/main/java/org/apache/maven/plugin/MojoFailureException.java
 Mon Sep 26 07:40:17 2005
@@ -0,0 +1,40 @@
+package org.apache.maven.plugin;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * An exception occuring during the execution of a plugin.
+ *
+ * @author Brett Porter
+ * @version $Id$
+ */
+public class MojoFailureException
+    extends AbstractMojoExecutionException
+{
+    public MojoFailureException( Object source, String shortMessage, String 
longMessage )
+    {
+        super( shortMessage );
+        this.source = source;
+        this.longMessage = longMessage;
+    }
+
+    public MojoFailureException( String message )
+    {
+        super( message );
+    }
+
+}

Propchange: 
maven/components/trunk/maven-plugin-api/src/main/java/org/apache/maven/plugin/MojoFailureException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/components/trunk/maven-plugin-api/src/main/java/org/apache/maven/plugin/MojoFailureException.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to