FELIX-1539: include additional source directories in local package calculation

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@810750 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 c708d9c..756681d 100644
--- a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
+++ b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
@@ -382,7 +382,7 @@
         if ( builder.getProperty( Analyzer.PRIVATE_PACKAGE ) == null
             || builder.getProperty( Analyzer.EXPORT_PACKAGE ) == null )
         {
-            addLocalPackages( currentProject.getBuild().getSourceDirectory(), builder );
+            addLocalPackages( currentProject.getCompileSourceRoots(), builder );
         }
 
         // update BND instructions to embed selected Maven dependencies
@@ -917,25 +917,29 @@
     }
 
 
-    private static void addLocalPackages( String sourceDirectory, Analyzer analyzer )
+    private static void addLocalPackages( List sourceDirectories, Analyzer analyzer )
     {
         Collection packages = new LinkedHashSet();
 
-        if ( sourceDirectory != null && new File( sourceDirectory ).isDirectory() )
+        for ( Iterator d = sourceDirectories.iterator(); d.hasNext(); )
         {
-            // scan local Java sources for potential packages
-            DirectoryScanner scanner = new DirectoryScanner();
-            scanner.setBasedir( sourceDirectory );
-            scanner.setIncludes( new String[]
-                { "**/*.java" } );
-
-            scanner.addDefaultExcludes();
-            scanner.scan();
-
-            String[] paths = scanner.getIncludedFiles();
-            for ( int i = 0; i < paths.length; i++ )
+            String sourceDirectory = (String) d.next();
+            if ( sourceDirectory != null && new File( sourceDirectory ).isDirectory() )
             {
-                packages.add( getPackageName( paths[i] ) );
+                // scan local Java sources for potential packages
+                DirectoryScanner scanner = new DirectoryScanner();
+                scanner.setBasedir( sourceDirectory );
+                scanner.setIncludes( new String[]
+                    { "**/*.java" } );
+
+                scanner.addDefaultExcludes();
+                scanner.scan();
+
+                String[] paths = scanner.getIncludedFiles();
+                for ( int i = 0; i < paths.length; i++ )
+                {
+                    packages.add( getPackageName( paths[i] ) );
+                }
             }
         }