maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1506892 - in /maven/enforcer/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer: AbstractEnforceMojo.java EnforceMojo.java RecommendMojo.java
Date Thu, 25 Jul 2013 11:18:01 GMT
Author: olamy
Date: Thu Jul 25 11:18:01 2013
New Revision: 1506892

URL: http://svn.apache.org/r1506892
Log:
Change the displayed message for recommendations.

Modified:
    maven/enforcer/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/AbstractEnforceMojo.java
    maven/enforcer/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/EnforceMojo.java
    maven/enforcer/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/RecommendMojo.java

Modified: maven/enforcer/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/AbstractEnforceMojo.java
URL: http://svn.apache.org/viewvc/maven/enforcer/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/AbstractEnforceMojo.java?rev=1506892&r1=1506891&r2=1506892&view=diff
==============================================================================
--- maven/enforcer/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/AbstractEnforceMojo.java
(original)
+++ maven/enforcer/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/AbstractEnforceMojo.java
Thu Jul 25 11:18:01 2013
@@ -148,9 +148,7 @@ public abstract class AbstractEnforceMoj
                             }
                             else
                             {
-                                list.add( "Rule " + i + ": " + currentRule
-                                        + " failed with message:\n"
-                                        + e.getMessage() );
+                                list.add( createRuleMessage( i , currentRule , e ));
                                 log.debug( "Adding failure due to exception" ,
                                         e );
                             }
@@ -295,4 +293,13 @@ public abstract class AbstractEnforceMoj
         this.translator = theTranslator;
     }
 
+    /**
+     * Returns the error message displayed when failFast is set to false.
+     *
+     * @param i index
+     * @param currentRule name of the current rule.
+     * @param e rule exception
+     * @return rule message
+     */
+    protected abstract String createRuleMessage( int i , String currentRule , EnforcerRuleException
e );
 }

Modified: maven/enforcer/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/EnforceMojo.java
URL: http://svn.apache.org/viewvc/maven/enforcer/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/EnforceMojo.java?rev=1506892&r1=1506891&r2=1506892&view=diff
==============================================================================
--- maven/enforcer/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/EnforceMojo.java
(original)
+++ maven/enforcer/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/EnforceMojo.java
Thu Jul 25 11:18:01 2013
@@ -21,6 +21,7 @@ package org.apache.maven.plugins.enforce
 
 
 import org.apache.maven.enforcer.rule.api.EnforcerRule;
+import org.apache.maven.enforcer.rule.api.EnforcerRuleException;
 import org.apache.maven.plugins.annotations.LifecyclePhase;
 import org.apache.maven.plugins.annotations.Mojo;
 import org.apache.maven.plugins.annotations.Parameter;
@@ -28,7 +29,7 @@ import org.apache.maven.plugins.annotati
 /**
  * This goal executes the defined enforcer-rules once per
  * module.
- * 
+ *
  * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
  * @version $Id$
  */
@@ -100,4 +101,10 @@ public class EnforceMojo
         return fail;
     }
 
+    @Override
+    protected String createRuleMessage( int i , String currentRule , EnforcerRuleException
e )
+    {
+        return "Rule " + i + ": " + currentRule + " failed with message:\n" + e.getMessage();
+    }
+
 }

Modified: maven/enforcer/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/RecommendMojo.java
URL: http://svn.apache.org/viewvc/maven/enforcer/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/RecommendMojo.java?rev=1506892&r1=1506891&r2=1506892&view=diff
==============================================================================
--- maven/enforcer/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/RecommendMojo.java
(original)
+++ maven/enforcer/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/RecommendMojo.java
Thu Jul 25 11:18:01 2013
@@ -21,12 +21,13 @@ package org.apache.maven.plugins.enforce
 
 
 import org.apache.maven.enforcer.rule.api.EnforcerRule;
+import org.apache.maven.enforcer.rule.api.EnforcerRuleException;
 import org.apache.maven.plugins.annotations.LifecyclePhase;
 import org.apache.maven.plugins.annotations.Mojo;
 import org.apache.maven.plugins.annotations.Parameter;
 
 /**
- * This goal executes the defined recommended enforcer-rules once per
+ * This goal executes the defined enforcer-recommendations once per
  * module. In contrast to {@link EnforceMojo} it will never fail the
  * build, i.e. it will only warn.
  * 
@@ -44,7 +45,7 @@ public class RecommendMojo
      * interface to execute.
      */
     @Parameter( required = true )
-    private EnforcerRule[] recommendedRules;
+    private EnforcerRule[] recommendations;
 
     /**
      * @return the recommendedRules
@@ -52,7 +53,7 @@ public class RecommendMojo
     @Override
     public EnforcerRule[] getRules ()
     {
-        return this.recommendedRules;
+        return this.recommendations;
     }
 
     /**
@@ -61,7 +62,7 @@ public class RecommendMojo
     @Override
     public void setRules ( EnforcerRule[] theRules )
     {
-        this.recommendedRules = theRules;
+        this.recommendations = theRules;
     }
 
     /**
@@ -90,4 +91,10 @@ public class RecommendMojo
     public boolean isFailFast() {
         return false;
     }
+
+    @Override
+    protected String createRuleMessage( int i , String currentRule , EnforcerRuleException
e )
+    {
+        return "Recommendation " + i + ": " + currentRule + " failed with message:\n" + e.getMessage();
+    }
 }



Mime
View raw message