FELIX-1262: remove duplicate resource entries to avoid Bnd Tool error (it suffixes duplicate entries with ~ and then can't find a file with that name)
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@793541 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundleplugin/pom.xml b/bundleplugin/pom.xml
index 607224c..9be6cf2 100644
--- a/bundleplugin/pom.xml
+++ b/bundleplugin/pom.xml
@@ -28,7 +28,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>maven-bundle-plugin</artifactId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>2.0.1-SNAPSHOT</version>
<packaging>maven-plugin</packaging>
<name>Maven Bundle Plugin</name>
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 f24039b..b34d934 100644
--- a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
+++ b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
@@ -36,6 +36,7 @@
import java.util.List;
import java.util.Map;
import java.util.Properties;
+import java.util.Set;
import java.util.jar.Attributes;
import java.util.jar.Manifest;
@@ -975,7 +976,7 @@
{
final String basePath = project.getBasedir().getAbsolutePath();
- StringBuffer resourcePaths = new StringBuffer();
+ Set pathSet = new LinkedHashSet();
for ( Iterator i = project.getResources().iterator(); i.hasNext(); )
{
org.apache.maven.model.Resource resource = ( org.apache.maven.model.Resource ) i.next();
@@ -1041,25 +1042,27 @@
path = targetPath + '/' + path;
}
- if ( resourcePaths.length() > 0 )
- {
- resourcePaths.append( ',' );
- }
-
+ // use Bnd filtering?
if ( resource.isFiltering() )
{
- resourcePaths.append( '{' );
- resourcePaths.append( path );
- resourcePaths.append( '}' );
+ path = '{' + path + '}';
}
- else
- {
- resourcePaths.append( path );
- }
+
+ pathSet.add( path );
}
}
}
+ StringBuffer resourcePaths = new StringBuffer();
+ for ( Iterator i = pathSet.iterator() ; i.hasNext(); )
+ {
+ resourcePaths.append( i.next() );
+ if ( i.hasNext() )
+ {
+ resourcePaths.append( ',' );
+ }
+ }
+
return resourcePaths.toString();
}