Equinox 可以在 Eclipse 之外使用吗?

can equinox be used outside of eclipse?

我想了解 osgi 并发现每个教程都需要 eclipse 或使用 eclipse 开发(这使我的理解复杂化)令人困惑

是否可以在没有 eclipse 的情况下使用 equinox,是否有示例说明如何做到这一点?

您可以在没有 Eclipse 的情况下创建 OSGi 应用程序。您在许多教程中看到的是使用 Eclipse 插件开发环境 (PDE) 进行 OSGi 开发。这是一种方式,但不是唯一的方式。

在 Apache Karaf 等许多 Apache 项目中,您可以看到非常不同的基于 maven 的 OSGi 开发。在这种情况下,您创建普通的 Maven 项目并简单地添加一个插件以使用 OSGi 元数据增强 jar。对于简单的捆绑包,这就是您所需要的。 作为示例,请参见 karaf examples and tutorials。在 karaf 作为 OSGi 服务器的情况下,您可以在 OSGi 框架的 equinox 和 felix 之间进行选择。

第三种方法是使用 bndtools. This again is a eclipse plugin and maven plugins but a completely different development workflow than PDE. The new examples for bndtools are also maven based like in Apache Karaf but they use a different assembly. As an example see this。它可以只用 maven 构建,但使用 bndtools eclipse 插件可以更容易。

虽然 Karaf 使用特性作为主要组装单元,但 bndtools 使用 OSGi 存储库 + 需求。

所以你可以选择三种不同的风格。每个都有不同的优点和缺点。 尤其是karaf风格对intellij也很适用

OSGi 是一个标准。 Equinox 是该标准的一个实现。正如 Equinox 主页上提到的,equinox 甚至是参考实现 (http://www.eclipse.org/equinox/) :

The Equinox OSGi core framework implementation is used as the reference implementation and as such it implements all the required features of the latest OSGi core framework specification

因此,是的,可以使用其他 OSGi 实现:Apache Felix,...(参见 https://en.wikipedia.org/wiki/OSGi_Specification_Implementations ). If you choose Felix, you will no longer use Equinox. But both implements the OSGi specification : https://osgi.org/javadoc/osgi.core/7.0.0/

此外,您必须将 OSGi 实现与您选择的开发环境区分开来 (IDE)。 Eclipse 是一个适用于两者的模糊术语。即使选择Felix实现,也可以在eclipse中编码。

我认为,如果您找到的大部分示例都是基于 Eclipse Equinox 并在 Eclipse 中开发的,那么这是以下事实的结果: - Equinox 是 OSGi 的参考实现 - Eclipse IDE 包括许多通过 PDE 开发 OSGi 应用程序的工具(插件开发环境:https://www.eclipse.org/pde/

总而言之,我想说 Eclipse 可能积累了最好的 IDE 和与 OSGi 一起工作的实现。据我所知,遵循基于 eclipse 的教程对您来说是一件好事,只要记住 equinox 是一个 OSGi 实现,您可以用 Felix 之类的其他实现代替它。