3

i have a bundle that uses maven-jaxb2-plugin to generate all classes to target/generated/src/main/java. Then i use maven bundle plugin to create a bundle. It simply works.

Now, i want to exclude (remove) a generated package com.xxx.yyyy.common out of this bundle. So i use:

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

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

Tunaki
  • 132,869
  • 46
  • 340
  • 423
David
  • 3,538
  • 9
  • 39
  • 50

2 Answers2

5

I have made it works. Basically, we need to use a combination between <Export-Package> and <Private-Package>. Tell maven bundle plugin to not export this package and this package is not a private package --> that means we dont need to keep this package in the bundle

<Export-Package>!com.xxx.yyyy.common</Export-Package>
<Private-Package>!com.xxx.yyyy.common</Private-Package>
vorburger
  • 3,439
  • 32
  • 38
David
  • 3,538
  • 9
  • 39
  • 50
2

The syntax you use, is just to exclude the package from being exported, not from being packaged. You need to use standard maven assembly instructions for excluding something from the packaged artifact. This is no goal for the maven-bundle-plugin, the maven-bundle-plugin only generates OSGi-Manifest entries from your packaged artifact.

Achim Nierbeck
  • 5,265
  • 2
  • 14
  • 22
  • Thanks. your opinion is one option we have used in other projects. For this project we prefer to work by using maven bundle plugin – David May 28 '15 at 19:21