FELIX-499: Enhance <excludeDependencies> to support comma-separated list of artifactIds

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@629367 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 b3865ae..37dd6dc 100644
--- a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
+++ b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
@@ -90,11 +90,11 @@
     protected boolean unpackBundle;
 
     /**
-     * When true, exclude project dependencies from the classpath passed to BND
+     * Comma separated list of artifactIds to exclude from the dependency classpath passed to BND (use "true" to exclude everything)
      *
      * @parameter expression="${excludeDependencies}"
      */
-    protected boolean excludeDependencies;
+    protected String excludeDependencies;
 
     /**
      * Classifier type of the bundle to be installed.  For example, "jdk14".
@@ -654,16 +654,7 @@
             list.add( new Jar( ".", getOutputDirectory() ) );
         }
 
-        final Set artifacts;
-        if ( excludeDependencies )
-        {
-            artifacts = Collections.EMPTY_SET;
-        }
-        else
-        {
-            artifacts = currentProject.getArtifacts();
-        }
-
+        final Collection artifacts = getSelectedDependencies( currentProject.getArtifacts() );
         for ( Iterator it = artifacts.iterator(); it.hasNext(); )
         {
             Artifact artifact = ( Artifact ) it.next();
@@ -692,6 +683,33 @@
     }
 
 
+    private Collection getSelectedDependencies( Set artifacts )
+    {
+        if ( null == excludeDependencies || excludeDependencies.length() == 0 )
+        {
+            return artifacts;
+        }
+        else if ( "true".equalsIgnoreCase( excludeDependencies ) )
+        {
+            return Collections.EMPTY_LIST;
+        }
+
+        List excludes = Arrays.asList( excludeDependencies.trim().split( "\\s*,\\s*" ) );
+
+        Collection classpath = new ArrayList();
+        for ( Iterator i = artifacts.iterator(); i.hasNext(); )
+        {
+            Artifact artifact = ( Artifact ) i.next();
+            if ( !excludes.contains( artifact.getArtifactId() ) )
+            {
+                classpath.add( artifact );
+            }
+        }
+
+        return classpath;
+    }
+
+
     /**
      * Get the file for an Artifact
      *