You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cz...@apache.org on 2009/04/06 20:56:37 UTC

svn commit: r762458 - /felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/SCRDescriptorMojo.java

Author: cziegeler
Date: Mon Apr  6 18:56:36 2009
New Revision: 762458

URL: http://svn.apache.org/viewvc?rev=762458&view=rev
Log:
FELIX-997 : Add a strictMode configuration which regards all warnings as errors.

Modified:
    felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/SCRDescriptorMojo.java

Modified: felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/SCRDescriptorMojo.java
URL: http://svn.apache.org/viewvc/felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/SCRDescriptorMojo.java?rev=762458&r1=762457&r2=762458&view=diff
==============================================================================
--- felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/SCRDescriptorMojo.java (original)
+++ felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/SCRDescriptorMojo.java Mon Apr  6 18:56:36 2009
@@ -95,6 +95,12 @@
     protected boolean processAnnotations;
 
     /**
+     * In strict mode the plugin even fails on warnings.
+     * @parameter default-value="false"
+     */
+    protected boolean strictMode;
+
+    /**
      * The comma separated list of tokens to exclude when processing sources.
      *
      * @parameter alias="excludes"
@@ -356,13 +362,16 @@
         component.validate(issues, warnings);
 
         // now log warnings and errors (warnings first)
-        Iterator<String> i = warnings.iterator();
-        while ( i.hasNext() ) {
-            this.getLog().warn(i.next());
-        }
-        i = issues.iterator();
-        while ( i.hasNext() ) {
-            this.getLog().error(i.next());
+        // FELIX-997: In strictMode all warnings are regarded as errors
+        if ( this.strictMode ) {
+            issues.addAll(warnings);
+            warnings.clear();
+        }
+        for(String warn : warnings) {
+            this.getLog().warn(warn);
+        }
+        for(String err : issues) {
+            this.getLog().error(err);
         }
 
         // return nothing if validation fails