FELIX-4049 : SCR-Plugin creates invalid manifest-header on incremental-build (eclipse-IDE-integration)

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1479334 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scrplugin/maven-scr-plugin/changelog.txt b/scrplugin/maven-scr-plugin/changelog.txt
index 8bcb540..bc92c1a 100644
--- a/scrplugin/maven-scr-plugin/changelog.txt
+++ b/scrplugin/maven-scr-plugin/changelog.txt
@@ -1,3 +1,9 @@
+Changes from 1.13.0 to 1.12.0
+-----------------------------
+** Bug
+    * [FELIX-4049] - SCR-Plugin creates invalid manifest-header on incremental-build (eclipse-IDE-integration)
+   
+
 Changes from 1.12.0 to 1.11.0
 -----------------------------
 ** Improvement
diff --git a/scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/SCRDescriptorMojo.java b/scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/SCRDescriptorMojo.java
index d5ee484..4f132ce 100644
--- a/scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/SCRDescriptorMojo.java
+++ b/scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/SCRDescriptorMojo.java
@@ -246,7 +246,7 @@
             }
 
             final Result result = generator.execute();
-            this.setServiceComponentHeader(result.getScrFiles());
+            this.setServiceComponentHeader();
 
             this.updateProjectResources();
             // don't try to delete per-class descriptors if only one descriptor is generated
@@ -398,10 +398,11 @@
     }
 
     /**
-     * Set the service component header based on the scr files.
+     * Set the service component header based on the files in the output directory
      */
-    private void setServiceComponentHeader(final List<String> files) {
-        if ( files != null && files.size() > 0 ) {
+    private void setServiceComponentHeader() {
+        final File osgiInfDir = new File(this.outputDirectory, "OSGI-INF");
+        if ( osgiInfDir.exists() ) {
             final String svcHeader = project.getProperties().getProperty("Service-Component");
             final Set<String> xmlFiles = new HashSet<String>();
             if ( svcHeader != null ) {
@@ -412,8 +413,10 @@
                 }
             }
 
-            for(final String path : files) {
-                xmlFiles.add(path);
+            for(final File f : osgiInfDir.listFiles()) {
+                if ( f.isFile() && f.getName().endsWith(".xml") ) {
+                    xmlFiles.add("OSGI-INF/" + f.getName());
+                }
             }
             final StringBuilder sb = new StringBuilder();
             boolean first = true;