从 Eclipse 导出 OSGI 应用程序
我使用 eclipse 开发了一个 osgi 应用程序(无 rcp)。它由几个 Plugin-Projects-Bundles 和来自 eclipse 插件文件夹 (commons.* ...) 的依赖项组成
。使用 eclipse 启动时,该应用程序工作正常。
从 Eclipse 导出和部署此类应用程序的最佳方法是什么?有没有一种简单的方法可以导出我的启动配置?
我找到的只是 rcp 项目。
I've developed an osgi application (no rcp) using eclipse. It consists of several Plugin-Projects-Bundles and dependencies from eclipse plugins folder (commons.* ...)
The application works fine when launched using eclipse.
What is the best way to export and deploy such an application from eclipse? Is there a simple way to export my launch configuration?
All I found was for rcp projects.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您需要做的就是通过 PDE(插件编辑器)认真填写 Manifest.MF,您必须
非常重要的是要注意第3点,正是在这里,大多数人都会犯错误,并想知道为什么项目在Eclipse中运行良好,但在导出时却无法运行。
All you need to do is religiously fill your Manifest.MF via PDE(Plugin Editor), you must
Its very important to note point 3, it is here where most people make mistake and wonder why the project is running perfectly in Eclipse but doesent run when exported.
查看新的 OSGi 和 Equinox 书中有关打包 OSGi/Equinox 应用程序的第 9 章。现在可以进行粗剪:http://my.safaribooksonline.com/9780321561510。该书应该会在 3 月份由 EclipseCon 提供印刷版供购买。
Check out Chapter 9 on packaging OSGi/Equinox applications in the new OSGi and Equinox book. It's available on rough cuts now: http://my.safaribooksonline.com/9780321561510. It should be available in print for purchase by EclipseCon in March.
创建 OSGi 包本身并不构成完整的应用程序。 OSGi 捆绑包需要一个容器,并且容器负责管理捆绑包的生命周期:加载捆绑包、解决依赖关系、调用捆绑包的激活器等。有多种可用的 OSGi 容器,例如 Knopflerfish (http://www.knopflerfish.org/),菲利克斯 (http://felix.apache.org/) 和 Equinox ( http://www.eclipse.org/equinox/)。在内部,Eclipse 使用 Equinox。
部署使用 OSGi 的应用程序需要配置容器,而执行此操作的确切机制取决于所选的容器。如果您希望继续使用 Equinox,请查看此快速入门指南,以在 Eclipse 外部配置和启动容器 (http://www.eclipse.org/equinox/documents/quickstart.php)。
Creating an OSGi bundle, by itself, does not constitute a complete application. OSGi bundles require a container and its the container's responsibility to manage the lifetime of the bundle: loading the bundle, resolving dependencies, invoking the bundle's activator, etc. There are several OSGi containers available such as Knopflerfish (http://www.knopflerfish.org/), Felix (http://felix.apache.org/), and Equinox (http://www.eclipse.org/equinox/). Internally, Eclipse uses Equinox.
Deploying an application that uses OSGi entails configuring the container and the exact mechanism for doing that depends on the chosen container. If you wish to continue using Equinox then check out this quick-start guide for configuring and launching the container outside Eclipse (http://www.eclipse.org/equinox/documents/quickstart.php).
PDE 生成的配置可以比从头开始编写 Equinox 配置更容易定制。在运行的基于 Eclipse 的 OSGi 环境中,键入bundle。您将看到 Equinox 将用于启动的所有运行时包放在哪里。其中应该有一个 PDE 为启动而生成的 config.ini。就我而言,它是 [workspace root]/.metadata/.plugins/org.eclipse.pde.core/[My Launch Config Name]/config.ini。
PDE generates a configuration that can be customized much easier that writing an Equinox config from scratch. In your running Eclipse-based OSGi environment, type bundles. You'll see where Equinox is putting all the runtime bundles for the launch. In there should be a config.ini that PDE is generating for the launch. In my case it's [workspace root]/.metadata/.plugins/org.eclipse.pde.core/[My Launch Config Name]/config.ini.
->在 Eclipse 中创建功能项目
->打开创建的项目的feature.xml文件。
->在“包含的插件”下添加所有必需的插件和依赖项
->确保您已添加所有 OSGI 相关“插件”
这是我正在使用的插件列表
->现在创建 OSGI 运行配置
->在“捆绑包”下,选择您的功能项目。
现在,所有插件都可以从 feature.xml 的“概述”选项卡中导出
-> Create a feature project in Eclipse
-> Open feature.xml file of the created project.
-> Add all the required Plug-ins and dependencies under "Included Plug-ins"
-> Ensure that you have added all OSGI dependant "Plug-ins"
Here is a list of Plug-in I am using
-> Now create the OSGI run configuration
-> Under "Bundles", select your feature project.
Now all the plug-ins can be exported from the Overview tab of your feature.xml