FELIX-997 : Add a strictMode configuration which regards all warnings as errors.

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@762458 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scrplugin/src/main/java/org/apache/felix/scrplugin/SCRDescriptorMojo.java b/scrplugin/src/main/java/org/apache/felix/scrplugin/SCRDescriptorMojo.java
index 2e6f3b4..f29b665 100644
--- a/scrplugin/src/main/java/org/apache/felix/scrplugin/SCRDescriptorMojo.java
+++ b/scrplugin/src/main/java/org/apache/felix/scrplugin/SCRDescriptorMojo.java
@@ -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());
+        // FELIX-997: In strictMode all warnings are regarded as errors
+        if ( this.strictMode ) {
+            issues.addAll(warnings);
+            warnings.clear();
         }
-        i = issues.iterator();
-        while ( i.hasNext() ) {
-            this.getLog().error(i.next());
+        for(String warn : warnings) {
+            this.getLog().warn(warn);
+        }
+        for(String err : issues) {
+            this.getLog().error(err);
         }
 
         // return nothing if validation fails