FELIX-526: Prepend embedded dependencies before maven resources to avoid overwriting them
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@643300 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 a9a742f..ef26443 100644
--- a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
+++ b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
@@ -354,14 +354,14 @@
properties.putAll( getDefaultProperties( currentProject ) );
properties.putAll( transformDirectives( originalInstructions ) );
- // update BND instructions to add Maven resources
- includeMavenResources( currentProject, properties, getLog() );
-
Builder builder = new Builder();
builder.setBase( currentProject.getBasedir() );
builder.setProperties( properties );
builder.setClasspath( classpath );
+ // update BND instructions to add included Maven resources
+ includeMavenResources( currentProject, properties, getLog() );
+
if ( null != classifier && classifier.trim().length() > 0 )
{
String bundleVersion = properties.getProperty( Analyzer.BUNDLE_VERSION );
diff --git a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/DependencyEmbedder.java b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/DependencyEmbedder.java
index 7d405c1..78b8c5f 100644
--- a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/DependencyEmbedder.java
+++ b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/DependencyEmbedder.java
@@ -423,8 +423,16 @@
}
else if ( mavenDependencies.length() > 0 )
{
- // original behaviour: append dependencies to the instruction
- properties.setProperty( directiveName, instruction + ',' + mavenDependencies );
+ if ( Analyzer.INCLUDE_RESOURCE.equalsIgnoreCase( directiveName ) )
+ {
+ // dependencies should be prepended so they can be overwritten by local resources
+ properties.setProperty( directiveName, mavenDependencies + ',' + instruction );
+ }
+ else // Analyzer.BUNDLE_CLASSPATH
+ {
+ // for the classpath we want dependencies to be appended after local entries
+ properties.setProperty( directiveName, instruction + ',' + mavenDependencies );
+ }
}
// otherwise leave instruction unchanged
}