How can I avoid having bnd create Private-Package entries from Bundle-ClassPath?

939 views Asked by At

I'm trying to create a bundle that wraps a jar, and all its dependencies (about 20 other jars) and exposes an interface of my own devising. I don't want to create bundles for all the dependencies since I want to create a "sealed component" that contains the whole mess.

A sample bnd file that shows the problem looks like

Bundle-Version: 0.0.0.${tstamp}
Export-Package:  \
    pub
Include-Resource: lib=lib/
Bundle-ClassPath: .,lib/ant-1.9.3.jar

(This is just a sample... In the real world there are about 20 entries in Bundle-Classpath) The last line being the problem. The Include-Resource entry will suck the wrapped jar and all it's dependencies into the bundle and that works great. However, adding all the jars to the Bundle-ClassPath causes bnd to add them to Private-Package. Normally I wouldn't care except that there are so many packages in the included jars that the bnd file gets HUGE, and bndtools blows up trying to create it.

I've tried creating Private-Package by hand and putting it in the bnd file, but bnd just overwrites it.

1

There are 1 answers

2
BJ Hargrave On

I am not sure why you are worried about Private-Package. It does not mean anything to an OSGi framework. It is just a bnd thing. If you don't want to see it in your manifest, just add

-removeheaders: Private-Package

to your bnd file.