Search code examples
eclipseosgiosgi-fragment

How to create an osgi fragment with Bnd?


Today I had a deeper look inside the bndTools for Eclipse. I had a good start, but I ask myself if it is possible to create osgi fragments with bndTools or bnd. From the bnd project description it tells me that the Fragment-Host header is ignored by bnd, but have not found out what this means.

Does someone know if creating a osgi fragment is possible with bnd, and if so how to do that?

Regards Markus


Solution

  • A fragment bundle is special in only two ways:

    • it cannot be started, so it should not contain a Bundle-Activator header, and
    • it needs to contain a Fragment-Host header with the symbolic name of the host you want to attach to.

    Other than that, it's a bundle like any other, so bnd does not need to handle this in any special way. bnd by default 'ignores' all headers it doesn't recognize, in which case it copies them verbatim to the resulting bundle's manifest.

    In Bndtools, you can add custom headers (i.e., those not directly supported by Bndtools) in the Source tab.