Require-Bundle和Import-Package与feature.xml需要 [英] Require-Bundle and Import-Package versus feature.xml requires

查看:273
本文介绍了Require-Bundle和Import-Package与feature.xml需要的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当构建由多个插件和一个功能组成的Eclipse插件( lato sensu )时,我有两种方法来指定依赖关系:

When building an Eclipse plugin (lato sensu) which consists of multiple plugins and one feature, I have two ways of specifying dependencies:


  • 在插件本身中,使用 Require-Bundle Import-Package META-INF / MANIFEST.MF ;

  • feature.xml 文件中这个功能。

  • in the plugins themselves, using Require-Bundle and Import-Package in META-INF/MANIFEST.MF;
  • in the feature.xml file from the feature.

根据我的理解,应该在较低级别声明依赖关系,即在插件中。为什么我们仍然有 feature.xml 需要机制?

In my understanding, it should be enough to declare the dependencies at the lower level, i.e. in the plugins. Why do we still have the feature.xml requires mechanism?

更新 Eclipse帮助中的feature.xml描述

推荐答案

考虑您正在构建JDT扩展的情况。说你只依靠JDT核心api(没有UI扩展)。如果您只依靠OSGi依赖项,安装插件时,p2将尽可能安装JDT核心软件包,而不是UI软件包。从OSGi的角度看,完全不错,但可能不是你所想的。

Consider the case where you are building an extension to JDT. Say you only depend on JDT core api (no UI extensions). If you only rely on OSGi dependencies, when your plugin is installed, p2 will dutifully install JDT core bundle, but not the UI bundle. Perfectly fine from OSGi perspective, but probably not what you intended.

我建议坚持使用功能导入来描述高级依赖关系,以确保它们已经完整安装。仅依靠OSGi依赖关系最适合于不应该作为一个单元安装的更大的一部分的自由浮动捆绑。

I recommend sticking with feature import to describe your high level dependencies to make sure that they are installed in full. Relying only on OSGi dependencies works best for free-floating bundles that aren't part of something bigger that should be installed as a unit.

这篇关于Require-Bundle和Import-Package与feature.xml需要的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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