How to exclude files/packages from the JAR?

I have some Maven modules that contain classes, but the JAR bundle artifacts they produce should not contain any of these classes - rather they should be limited including some data resources.

With the maven-bundle-plugin, I can exclude packages from the JAR by adding an exclude pattern to the Private-Package and Export-Package directives.

With the bnd-maven-plugin, it seems that this does not work. I also tries negative packages with -privatepackage and -includepackage, but that did also not have the desired effect.

Is it possible at all to tell the bnd-maven-plugin to exclude a particular package from the generated JAR?

Ping anybody? :bellhop_bell:

I think the newer plugins leave the actual content assembly to the default Maven JAR packager. In the old plugin, bnd created the JAR completely.

I have been able to resolve my problem by not executing the bnd-jar goal. This restores the execution of the maven-jar-plugin. The only thing I had to still do then was to configure the maven-jar-plugin to pick up the MANIFEST.MF file created by bnd-process.


I have the impression since turning off bnd-jar, m2e is much more inclined to enter an endless build loop for some random maven project… :confused:

I have the impression that the Bnd Decorator in the Bnd Eclipse plugins triggers a jar:jar execution if the bnd-jar goal does not suppress it and that this somehow causes the endless loop.

Can you file a bug? Please include as much information as you can.