FELIX-620: special handling when only exportcontents is used
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@675105 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 2db563b..cdc7623 100644
--- a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
+++ b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
@@ -363,13 +363,23 @@
includeMavenResources( currentProject, properties, getLog() );
if ( !properties.containsKey( Analyzer.EXPORT_PACKAGE ) &&
- !properties.containsKey( Analyzer.EXPORT_CONTENTS ) &&
!properties.containsKey( Analyzer.PRIVATE_PACKAGE ) )
{
- String bsn = properties.getProperty( Analyzer.BUNDLE_SYMBOLICNAME );
- String namespace = bsn.replaceAll( "\\W", "." );
+ if ( properties.containsKey( Analyzer.EXPORT_CONTENTS ) )
+ {
+ /*
+ * if we have exportcontents but no export packages or private packages then we're probably embedding or
+ * inlining one or more jars, so set private package to a non-null (but empty) value to keep Bnd happy.
+ */
+ properties.put( Analyzer.PRIVATE_PACKAGE, "!*" );
+ }
+ else
+ {
+ String bsn = properties.getProperty( Analyzer.BUNDLE_SYMBOLICNAME );
+ String namespace = bsn.replaceAll( "\\W", "." );
- properties.put( Analyzer.EXPORT_PACKAGE, namespace + ".*" );
+ properties.put( Analyzer.EXPORT_PACKAGE, namespace + ".*" );
+ }
}
// update BND instructions to embed selected Maven dependencies