3

Maven bundle plugin, as I know, will automatically add export/import package information to your bundle manifest.mf file, according to it sources.

Sometimes you need manually specify export-packages for example if you want to add *.impl packages, which maven-bundle-plugin will not include automatically. But if you specify packages in <Export-Package> tag, automatic export would not be performed. If I have only one package that requires to be declared manually and other could be added to export-package block automatically by this plugin. So I want to use automatically generated export-package manifest and add to it manually specified packages.

How can I turn on automatic generation of export info while I using manual?

Rahul
  • 44,383
  • 11
  • 84
  • 103
Architect
  • 155
  • 2
  • 11

1 Answers1

2

The Export-Package instruction can use wildcards. It takes all packages on the classpath and will then apply the glob expression to this list. So you can do:

  <Export-Package>com.example.myimpl.*, com.example.other.*</Export-Package>

It is not recommended to use * because this will include the whole transitive classpath.

Peter Kriens
  • 15,196
  • 1
  • 37
  • 55
  • It's a good feature. But it is not actually what i need. I can specify several packages at once by wildcard, but it would not help to keep automatically generated export-import info. When i use Export-Package (even with a wildcard), aytomaticaly generated info will be replaced by packages, specified in this tag. – Architect Nov 26 '13 at 06:52
  • I am not sure I understand what you want – Peter Kriens Nov 26 '13 at 07:58
  • If not specify tag, Maven Bundle Plugin will generate manifest info automatically, according to project dependencies and class usages in your code. This info would not be included into manifest if you add tag. – Architect Nov 27 '13 at 11:26
  • 1
    I think I understand (I dislike maven's defaults so would never use them, the JAR layout must imho be consciously designed, not ad-hoc). Anyway, you can also use -exportcontents, same syntax as Export-Package but is only applied for calculating the manifest. – Peter Kriens Nov 27 '13 at 13:11