How to use maven bundle plugin to exclude a package from a bundle

I have a package that uses maven-jaxb2-plugin to generate all classes for target / generated / src / main / java. Then I use the maven bundle plugin to create the bundle. It just works.

Now I want to exclude (remove) the generated com.xxx.yyyy.common package from this package. Therefore, I use:

<Export-Package>
     !com.xxx.yyyy.common,com.xxx.*
</Export-Package>

      

But after having a package, that package is still inside the package.

+3


source to share


2 answers


I did it. Basically, we need to use a combination between <Export-Package>

and <Private-Package>

. Download maven bundle plugin not to export this bundle and this bundle is not a private bundle -> this means we don't need to store this bundle in a bundle



<Export-Package>!com.xxx.yyyy.common</Export-Package>
<Private-Package>!com.xxx.yyyy.common</Private-Package>

      

+4


source


The syntax you are using is just to exclude the package from being exported, not out of the box. You need to use standard maven build instructions to exclude anything from the packaged artifact. This is not a target for the maven-bundle-plugin, the maven-bundle-plugin only generates the OSGi-Manifest entries from your bundled artifact.



+2


source







All Articles