如何为Apache POI 3.8创建有效的OSGI捆绑包? [英] How to create a working OSGI bundle for Apache POI 3.8?

查看:157
本文介绍了如何为Apache POI 3.8创建有效的OSGI捆绑包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的目标是在Eclipse RCP环境中创建Excel 2007文档(XLSX)(Excel 2003很简单).我不想将POI罐子放在/lib文件夹内,相反,我想使用目标定义中的POI OSGI捆绑包.

My goal is to create an Excel 2007 document (XLSX) in an Eclipse RCP Environment (Excel 2003 is simple). I don't want to place the POI jars inside a /lib folder, instead I want to use a working POI OSGI bundle from my target definition.

到目前为止,我所有的尝试都未能创建兴趣点3.8 .我到目前为止所做的:

All my attempts so far have failed to create a working OSGI bundle of POI 3.8. What I did so far:

  • 我将所有相关的JAR文件与Ant zip 任务合并:

  • poi-3.8-beta3-20110606.jar
  • poi-ooxml-3.8-beta3-20110606.jar
  • poi-ooxml-schemas-3.8-beta3-20110606.jar
  • poi-scratchpad-3.8-beta3-20110606.jar

我使用 wrap 参数运行了 bnd 工具:java -jar biz.aQute.bnd.jar wrap ./poi-3.8-beta3-20110606-merged.jar

I ran the bnd tool with the wrap parameter: java -jar biz.aQute.bnd.jar wrap ./poi-3.8-beta3-20110606-merged.jar

我必须用bnd分别将/ooxml-lib文件夹中的jar捆绑在一起:

I had to bundle the jars in the /ooxml-lib folder separately, with bnd:

  • xmlbeans-2.3.0.jar
  • stax-api-1.0.1.jar
  • dom4j-1.6.1.jar

这会导致org.w3c.dom.Node的ClassNotFoundExceptions,因为xmlbeans-2.3.0.jar从此包org.w3c.dom中导出了四个类.通常,JavaSE-RuntimeEnvironment会导出这些文件.

This leads to ClassNotFoundExceptions for org.w3c.dom.Node because xmlbeans-2.3.0.jar exports four classes from this package org.w3c.dom. Normally the JavaSE-RuntimeEnvironment would export these.

我从xmlbeans-2.3.0.jar中删除了org/w3c/dom文件夹并重新打包了jar,但是我遇到了其他ClassNotFoundExceptions.

I deleted the org/w3c/dom folder from xmlbeans-2.3.0.jar and rebundled the jar but I got other ClassNotFoundExceptions.

这是我到目前为止的去向.我认为使用 bnd wrap 是不够的.可能我必须创建一个 bnd.properties 文件,并具有显式的Export-Package/Import-Package语句,但是哪个有效?

This is where I got so far. I think working with bnd wrap is not enough. Probably I must create a bnd.properties file and have explicit Export-Package/Import-Package statements but which work?

那么,有没有人成功地创建了一个有效的POI 3.8 OSGI捆绑包?

So, has anyone successfully managed to create a working POI 3.8 OSGI bundle?

推荐答案

如果您不需要该特定版本,只需使用

If you don't need that specific version, simply use http://ebr.springsource.com/repository/app/bundle/version/detail?name=com.springsource.org.apache.poi&version=3.0.2.FINAL that page lists it's dependencies etc (which you can also download or reference if you're using Maven/Ivy)

可能是 http://engroup.sourceforge.net/maven2/engroup/osgi/commons/poi-osgi/3.1/ http://ebr.springsource.com /repository/app/search?query = poi 可以提供一些启发(在第一个链接中,有一个maven POM在捆绑插件部分中列出了(bnd)指令).

May be http://engroup.sourceforge.net/maven2/engroup/osgi/commons/poi-osgi/3.1/ or http://ebr.springsource.com/repository/app/search?query=poi can provide some inspiration (in the first link there's a maven POM that lists the (bnd) instructions in the bundle plugin section).

你为什么要合并罐子?为什么不尝试将它们单独包装?

Why are you merging the jars? Why not try wrapping each individually?

要尝试的第二件事是使用 stax-api dom4j

A second thing to try is to use existing OSGi'd jars of xmlbeans, stax-api and dom4j

您还可以使用"org.osgi.framework.system.packages"配置JRE(系统捆绑包)导出的内容-这样您就可以选择不导出org.w3c.dom

Also you can configure what the JRE (system bundle) exports using "org.osgi.framework.system.packages" - so you can choose not to export org.w3c.dom

这篇关于如何为Apache POI 3.8创建有效的OSGI捆绑包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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