【问题标题】:How to add a custom osgi bundle as new dependency?如何将自定义 osgi 包添加为新依赖项?
【发布时间】:2012-11-23 15:13:49
【问题描述】:

我需要处理 OSGi 包中的 xlsx Excel 文档,但 org.apache.servicemix.bundles.poi 缺少使用 2007 和更早格式的类。

我创建了一个带有完整 apache poi 的 OSGi 包(jar 文件)(包括官方 apache poi 包中不存在的 ooxml 类)。我用过this pom.

所以,经过一番努力,我得到了我想要的捆绑包。现在的问题是如何将它与我现有的捆绑包一起使用?我如何告诉它导入我需要的东西?从理论上讲,这个 pom 文件有 <servicemix.osgi.export> 列出要导出的命名空间,我应该能够将它们导入我的包中。

【问题讨论】:

  • org.apache.servicemix.bundles.poi 缺少使用 office 2007 格式的类。自我修复
  • 你看过Export-package和Import-package,明白它们的意思了吗?或者至少表明您对 OSGi 的经验水平,以便人们知道您可能遇到什么样的问题。
  • 我的 poi 包的导出具有这样的命名空间: org.apache.poi*;-split-package:=merge-first, org.openxmlformats.schemas*;-split -package:=merge-first, ... 等
  • 在我的项目中,我有“build helper maven plugin”,它附加了 features.xml 文件中的工件,我在其中添加了对 poi 包的依赖项。但是当我运行我的包时,它仍然有 ClassNotFoundException "org.apache.servicemix.bundles.poi [737] 找不到 org.apache.poi.ss.usermodel.WorkbookFactory" 为什么它寻找 "org.apache.servicemix.bundles .poi”?我根本没有这样的依赖。它应该在我的 poi 包中查找。
  • 很难理解你的问题。你看过你的包的清单吗?它导入什么包?您是生成清单还是自己编写的?

标签: osgi openxml osgi-bundle apache-servicemix


【解决方案1】:

如果您所做的只是用 OSGI 捆绑清单信息包装 Apache POI,请考虑使用预打包且免费提供的 Eclipse Orbit 项目输出:http://download.eclipse.org/tools/orbit/downloads/

该站点包含多个版本的 Apache POI 以及许多其他 OSS 项目作为 OSGI 捆绑包。除了您之外,还有其他人维护、构建它们,还有许多其他人也在使用它们。

【讨论】:

    猜你喜欢
    • 2018-09-10
    • 2017-07-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-07
    • 2013-03-23
    • 2013-02-04
    • 2014-03-18
    相关资源
    最近更新 更多