Private-Package has a special meaning in the maven bundle plugin (or in
bnd ... bot sure where it is handled).
If you specify a package as Private-Package then it is excluded from the
exports in Export-Package. If you specify a private package that is not
inside the sources of your current
maven project then the classes of this package are copied into the jar
of the bundle. This makes sense as it is the only way to have access to
these classes but it was quite surprising to me when I first saw it.
Btw. for your case you should not have to configure anything special.
Bnd already treats package names that contain strings like internal orI
think also impl specially and does not include those into the
Export-Package header.
Another important thing is that you can add ",*" to your exports to let
bnd handle its defaults If you leave this out then it will only export
what you explicitly mention.
In any case it is a good practice to look into the Manifest to see what
actually ends up in the headers.
Christian
Am 22.08.2013 00:38, schrieb bokie:
Hi,
I'm currently experimenting with the Bundle Plugin for Maven
<http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html> .
I essentially want to learn maven and at the same time get a feel for and
weigh the PROS and CONS of developing OSGi solutions "The Maven Way".
I've created a small Maven type project in Eclipse, edited the pom.xml file
to look like:
=============
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>abc.projectx</groupId>
<artifactId>bundlex</artifactId>
<packaging>bundle</packaging>
<version>1.0.0</version>
<dependencies>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>core</artifactId>
<version>4.3.1</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>cmpn</artifactId>
<version>4.3.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.4.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-Activator>abc.projectx.bundlex.internal.Activator</Bundle-Activator>
<Private-Package>abc.projectx.bundlex.internal</Private-Package>
<Export-Package>abc.projectx.bundlex</Export-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>
=============
When I right click the pom.xml file > Run As > Maven Build... > Goals:
bundle:bundle, everything looks fine except for the Private-Package which
seems to be ignored (I don't see it in the final MANIFEST.MF)
=============
Manifest-Version: 1.0
Bnd-LastModified: 1377123088222
Build-Jdk: 1.7.0_25
Built-By: User
Bundle-Activator: abc.projectx.bundlex.internal.Activat
or
Bundle-ManifestVersion: 2
Bundle-Name: bundlex
Bundle-SymbolicName: abc.projectx.bundlex
Bundle-Version: 1.0.0
Created-By: Apache Maven Bundle Plugin
Export-Package: abc.projectx.bundlex;version="1.0.0"
Import-Package: org.osgi.framework;version="[1.6,2)"
Tool: Bnd-2.1.0.20130426-122213
=============
--
View this message in context:
http://apache-felix.18485.x6.nabble.com/Maven-tp5004631.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
--
Christian Schneider
http://www.liquid-reality.de
Open Source Architect
Talend Application Integration Division http://www.talend.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]