需要在Bndtools中添加一个Container

Need to add a Container to Bndtools

我正在使用 Bndtools 进行一些开发。 Bndtools 为 Apache Felix 和(显然)为 Equinox 提供开箱即用的 OSGi 运行时。

但是,假设您想在 Knopflerfish 的 Bndtools 中开发捆绑包并对其进行测试?或者对于某些公司的专有容器(是的,它们确实存在,足够令人惊讶!)? Bndtools 可以很容易地向开发环境添加单独的包,但似乎没有任何明显的方法可以添加完整的运行时进行测试。

是否可以通过某种方式将备用 OSGi 运行时环境添加到 Bndtools?

只需获取框架 JAR 并将其拖放到您的存储库之一,例如本地存储库。然后它将出现在 运行 编辑器的 OSGi 框架下拉列表中。

注意,您可能需要关闭并重新打开编辑器才能刷新下拉列表内容。

bnd(tools) 中的想法是在 bndrun 文件中定义您的运行时。您可以根据需要创建任意数量的 bndrun 个文件。 bndrun 文件包含环境设置(框架、系统包、属性等)和捆绑包列表。框架和捆绑包来自存储库。正如 Neil 所指出的,您可以通过将它们添加到存储库来添加不同的框架。

您可以在 bndrun 文件中包含带有 -include 的文件,以便在不同的 bndrun 文件之间共享变量。然后最好使用解析器创建 -runbundles.

的列表

在 OSGi enRoute 中,我们通过这种方式为实际应用程序和调试环境创建了不同的运行时。请参阅 OSGi enRoute cm example, look at the debug.bndrun and osgi.enroute.exampes.cm.bndrun file. Notice that the debug.bndrun file includes the osgi.enroute.exampes.cm.bndrun file so any setup is automatically inherited. Also note the use of merged properties,它允许您添加属性而无需踩到包含文件的脚趾。