FELIX-1985: warn when duplicate paths appear in Include-Resource

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1139605 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
index 5da44dd..9bf322a 100644
--- a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
+++ b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
@@ -297,18 +297,33 @@
             List errors = builder.getErrors();
             List warnings = builder.getWarnings();
 
+            String warningPrefix = "Warning building bundle " + currentProject.getArtifact() + " : ";
             for ( Iterator w = warnings.iterator(); w.hasNext(); )
             {
                 String msg = ( String ) w.next();
-                getLog().warn( "Warning building bundle " + currentProject.getArtifact() + " : " + msg );
+                getLog().warn( warningPrefix + msg );
             }
+
+            boolean hasErrors = false;
+            String errorPrefix = "Error building bundle " + currentProject.getArtifact() + " : ";
+            String fileNotFound = "Input file does not exist: ";
             for ( Iterator e = errors.iterator(); e.hasNext(); )
             {
                 String msg = ( String ) e.next();
-                getLog().error( "Error building bundle " + currentProject.getArtifact() + " : " + msg );
+                if ( msg.startsWith( fileNotFound ) && msg.endsWith( "~" ) )
+                {
+                    // treat as warning; this error happens when you have duplicate entries in Include-Resource
+                    String duplicate = Processor.removeDuplicateMarker( msg.substring( fileNotFound.length() ) );
+                    getLog().warn( warningPrefix + "Duplicate path '" + duplicate  + "' in Include-Resource" );
+                }
+                else
+                {
+                    getLog().error( errorPrefix + msg );
+                    hasErrors = true;
+                }
             }
 
-            if ( errors.size() > 0 )
+            if ( hasErrors )
             {
                 String failok = builder.getProperty( "-failok" );
                 if ( null == failok || "false".equalsIgnoreCase( failok ) )