开发者

Force OSGi package to be imported by maven-bundle-plugin / BND

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 MANIFES开发者_高级运维T.

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

Thanks and regards Klaus


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜