tags:

views:

34

answers:

1

Hello,

I try to package an OSGI bundle using the maven-bundle-plugin (which uses BND).

To run properly the bundle must import a package which is not in the classpath during development (because object references will be passed to the bundle methods as "Class" references).

I do not manage to configure the "Import-Package" declaration in the pom.xml or *.bnd file so that the packe will be included in the OSGI Import-Package part of the MANIFEST. I though

Import-Package: de.foo.bar,*

should do the job, but as de.foo.bar is not in the classpath (or better not declared as an import in the code) it will not be taken to the MANIFEST.

Has anybody an idea how to force the package to be available in the OSGi Import-Package MANIFEST declaration.

Thanks and regards Klaus

A: 

I finally found a solution

Import-Package: de.foo.bar;resolution:=optional,*

will put "de.foo.bar" in the "Import-Package" declaration of the bundle MANIFEST.MF even if the package is not imported by the bundle code.

K. Claszen