当我们在eclipse插件依赖关系中有“必需的插件”时,为什么需要“导入包”? [英] Why do we need `Imported Packages` when we have `Required Plug-ins` in eclipse plugin dependencies?

查看:193
本文介绍了当我们在eclipse插件依赖关系中有“必需的插件”时,为什么需要“导入包”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在开发eclipse应用程序时,MANIFEST.MF中的依赖选项卡有两列。
一个是必需的插件,另一个是导入的包

In developing eclipse application, the dependencies tab in MANIFEST.MF has two columns. One is Required Plug-ins and the other is Imported Packages.

当我们有需要的插件时,为什么需要导入的软件包

Why do we need Imported Packages when we have Required Plug-ins?

该评论有这个插件取决于没有明确标识他们的原始插件,但我'不知道在什么情况下不想明确识别他们的原始插件,它的优点是什么?

The comment has it that this plug-in depends without explicitly identifying their originating plug-in, but I'm not sure in what case one doesn't want to explicitly identify their originating plug-in, and what's the advantage of it?

相关问题 - Eclipse Packages和插件有什么区别?

推荐答案

导入包提供额外的需要捆绑的间接级别。

Importing a package provides an extra level of indirection over requiring a bundle.

考虑一些标准API ... org.standard.framework的情况。假设两家公司实施这个API,也许你有捆绑com.abc.framework和com.xyz.framework。这两个执行包都将导出org.standard.framework包。

Consider the case of some standard API... org.standard.framework. Suppose two companies implement this API, maybe you have bundles com.abc.framework and com.xyz.framework. Both of these implementation bundles would export org.standard.framework package.

现在假设你需要一个org.standard.framework实现,但是你并不特别关心哪一个。如果你需要com.abc.framework或者com.xyz.framework包,你就是把它绑在一个特定的实现上。使用import-package指令,您将使OSGi作为间接层。

Now suppose, you need an org.standard.framework implementation, but you don't particularly care which one. If you require either com.abc.framework or com.xyz.framework bundle, you are tying yourself to a particular implementation. With an import-package directive, you are letting OSGi serve as an indirection layer.

import-package的另一个优点是,如果一个包,则依赖关系不需要更改被移动到另一个包。在捆绑分解或组合时,重构过程中可能会出现这种情况。

Another advantage of import-package is that your dependencies do not need to change if a package is moved to another bundle. This situation can arise during refactoring when bundles are broken up or combined.

由于这些原因,OSGi规范编写者现在一般建议使用相对较新的import-package伪指令,束。问题在于,并不是所有的软件包都准备好了。许多还没有在导出包时指定版本。这使得import-package在许多情况下不切实际。

For these reasons, OSGi spec writers now generally recommend using the relatively newer import-package directive over require-bundle. The problem is that not all of the bundles are ready for this. Many do not yet specify a version when exporting a package. This makes import-package impractical in many cases.

这篇关于当我们在eclipse插件依赖关系中有“必需的插件”时,为什么需要“导入包”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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