Eclipse OSGi包重新生成另一个bundle的片段 [英] Eclipse OSGi bundle reqiure another bundle's fragment

查看:162
本文介绍了Eclipse OSGi包重新生成另一个bundle的片段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能是一个简单的问题,但有一段时间我感到困惑。



我正在开发依赖于谷歌的gui的OSGi软件包。 Google的guice有一个主要的包和几个片段,如辅助注射片段。
在我的包中,我使用了辅助的注入片段和从该片段导出的类。但是在Eclipse中,我只能在另一个bundle(在这种情况下是guice bundle)中设置bundle依赖,而不是直接在一个fragment(辅助注入)上),因此Eclipse抱怨找不到从片段导出的类。



我如何对bundle的片段有依赖关系?

解决方案

对片段的导出包使用 Import-Package 依赖关系。实际上,您应该使用 Import-Package 为所有依赖项,并避免要求-Bundle 尽可能。


This might be simple question but have confused me for sometime.

I'm developing an OSGi bundle which rely on google guice. Google guice has one main bundle and several fragment like assisted inject fragment. In my bundle I have used the assisted inject fragment and a class that is exported from that fragment.

However in Eclipse, I can only set bundle dependency on another bundel (in this case, the guice bundle) but not directly on a fragment (assisted inject), hence Eclipse complains cannot find the class exported from the fragment.

How can I have the dependency on a bundle's fragment?

解决方案

Use an Import-Package dependency on the fragment's exported packages.

In fact you should use Import-Package for all your dependencies, and avoid Require-Bundle wherever possible.

这篇关于Eclipse OSGi包重新生成另一个bundle的片段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆