Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Sometimes additions are needed for <Import-Package>

The Eclipse-built manifests put in Require-Bundle entries for things you list in as bundle dependencies. You can continue to do this, also, using the maven-bundle-plugin because it will just pass thru any instructions that start with capital letters like "Require-Bundle" to the manifest.

However, the default is to not do this, but to put the dependencies at a finer granularity than a bundle, using the "uses-" clause in the Export-Package and Private-Package directives. These are imports that OSGi is free to supply from any bundle that exports them. Of course, in our main use case, there is only one such bundle, and everything should work.

The Import-Package directive is there to allow specifying more details about the particulars of the package you want to import, such as a particular version, or a particular bundle it must come from. Eclipse doesn't use them, and we don't either (at the moment).

Issues

bundle plugin uses <Import-Package> in preference to <Require-Bundle>. This approach has a finer granularity (often there are many "packages" within one bundle), and seems to be the preferred approach for managing OSGi component integration.

To compute the needed imports, the bundle plugin scans the byte-code of the classes it put into the plugin. Sometimes, this can misses needed things. An example is when your source uses org.eclipse.swt.SWT class, which has mainly "constants" declared as final int - these are compiled-away and only the resulting int appears in the byte code.

To handle these cases, those plugins which don't compile after the bundle builds the manifest.mf, because they are missing includes, have the required includes added to the POMThe jcasgen plugin no longer builds, unless you go to the project -> properties -> Java Compiler -> Errors/Warnings and change the setting for Deprecated and Restricted API -> forbidden reference from "Error" to "Warning". I'm guessing that some code here is using old, deprecated things, that might no longer work in Eclipse 3.3.