You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by fg...@apache.org on 2006/01/01 23:43:08 UTC

svn commit: r360577 - /maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java

Author: fgiust
Date: Sun Jan  1 14:43:04 2006
New Revision: 360577

URL: http://svn.apache.org/viewcvs?rev=360577&view=rev
Log:
MCHECKSTYLE-28 make console output optional
New consoleOutput parameter

Modified:
    maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java

Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java?rev=360577&r1=360576&r2=360577&view=diff
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java (original)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java Sun Jan  1 14:43:04 2006
@@ -372,6 +372,12 @@
     private MavenProject project;
 
     /**
+     * Output errors to console.
+     * @parameter default-value="false"
+     */
+    private boolean consoleOutput;
+
+    /**
      * @component
      * @required
      * @readonly
@@ -681,7 +687,10 @@
             checker.addListener( listener );
         }
 
-        checker.addListener( getConsoleListener() );
+        if ( consoleOutput )
+        {
+            checker.addListener( getConsoleListener() );
+        }
 
         CheckstyleReportListener sinkListener = new CheckstyleReportListener( sourceDirectory );
 
@@ -700,7 +709,11 @@
         {
             // TODO: should be a failure, not an error. Report is not meant to throw an exception here (so site would
             // work regardless of config), but should record this information
-            throw new MavenReportException( "There are " + nbErrors + " formatting errors." );
+            throw new MavenReportException( "There are " + nbErrors + " checkstyle errors." );
+        }
+        else if ( nbErrors > 0 )
+        {
+            getLog().info( "There are " + nbErrors + " checkstyle errors." );
         }
 
         return sinkListener.getResults();