如何将Liferay DXP与Apache POI集成? [英] How to integrate Liferay DXP with Apache POI?

查看:152
本文介绍了如何将Liferay DXP与Apache POI集成?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Apache POI集成到 Liferay DXP(OSGi)中,但是无法在gradle项目中解决POI 3.17版本的依赖性. 我用下面的JAR创建了一个独立项目:

I'm trying to integrate Apache POI in Liferay DXP(OSGi), but unable to resolve dependencies with POI 3.17 version in gradle project. I've created standalone project with below JAR's :

  1. poi-3.17.jar
  2. poi-ooxml-3.17.jar
  3. poi-ooxml-schemas-3.17.jar
  4. xmlbeans-2.6.0.jar
  5. commons-collections4-4.1.jar

此外,我还在 build.gradle

compile group: 'org.apache.poi', name: 'poi', version: '3.17'
compile group: 'org.apache.poi', name: 'poi-ooxml', version: '3.17'
compile group: 'org.apache.poi', name: 'poi-ooxml-schemas', version: '3.17'
compile group: 'org.apache.xmlbeans', name: 'xmlbeans', version: '2.6.0'
compile group: 'org.apache.commons', name: 'commons-collections4', version: '4.1'

此外,还分别在 bnd.bnd 中提供了相应的jar. 有什么线索我在这里想念吗?

Moreover, respective jars also provided into bnd.bnd as well. Any clue what I'm missing here?

推荐答案

经过大量调查,我找到了解决方案并纠正了Liferay DXP和Apache POI集成的依赖项管理.

After a lot investigation, I found the solution and correct dependencies management for Liferay DXP and Apache POI integration.

在build.gradle中添加以下依赖项:

Add below dependencies in build.gradle :

  • compile group: 'org.apache.commons', name: 'commons-collections4', version: '4.1'
  • compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.4'
  • compile group: 'org.apache.poi', name: 'poi', version: '3.17'
  • compile group: 'org.apache.poi', name: 'poi-excelant', version: '3.17'
  • compile group: 'org.apache.poi', name: 'poi-ooxml', version: '3.17'
  • compile group: 'org.apache.poi', name: 'poi-ooxml-schemas', version: '3.17'
  • compile group: 'org.apache.poi', name: 'poi-scratchpad', version: '3.17'
  • compile group: 'org.apache.poi', name: 'ooxml-schemas', version: '1.3'
  • compile group: 'org.apache.poi', name: 'ooxml-security', version: '1.1'
  • compile group: 'org.apache.xmlbeans', name: 'xmlbeans', version: '2.6.0'
  • compile group: 'org.apache.commons', name: 'commons-collections4', version: '4.1'
  • compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.4'
  • compile group: 'org.apache.poi', name: 'poi', version: '3.17'
  • compile group: 'org.apache.poi', name: 'poi-excelant', version: '3.17'
  • compile group: 'org.apache.poi', name: 'poi-ooxml', version: '3.17'
  • compile group: 'org.apache.poi', name: 'poi-ooxml-schemas', version: '3.17'
  • compile group: 'org.apache.poi', name: 'poi-scratchpad', version: '3.17'
  • compile group: 'org.apache.poi', name: 'ooxml-schemas', version: '1.3'
  • compile group: 'org.apache.poi', name: 'ooxml-security', version: '1.1'
  • compile group: 'org.apache.xmlbeans', name: 'xmlbeans', version: '2.6.0'

在bnd.bnd文件的属性"下面添加

Add below Properties in bnd.bnd file

Include-Resource:\ @commons-collections4-4.1.jar,\ @commons-lang3-3.4.jar,\ @ooxml-schemas-1.3.jar,\ @ooxml-security-1.1.jar,\ @poi-3.17.jar,\ @poi-ooxml-3.17.jar,\ @poi-ooxml-schemas-3.17.jar,\ @poi-excelant-3.17.jar,\ @poi-scratchpad-3.17.jar,\ @xmlbeans-2.6.0.jar

Include-Resource:\ @commons-collections4-4.1.jar,\ @commons-lang3-3.4.jar,\ @ooxml-schemas-1.3.jar,\ @ooxml-security-1.1.jar,\ @poi-3.17.jar,\ @poi-ooxml-3.17.jar,\ @poi-ooxml-schemas-3.17.jar,\ @poi-excelant-3.17.jar,\ @poi-scratchpad-3.17.jar,\ @xmlbeans-2.6.0.jar

Import-Package: \ !com.sun.*,\ !junit*,\ !org.apache.avalon.framework.logger,\ !org.apache.crimson.jaxp,\ !org.apache.jcp.xml.dsig.internal.dom,\ !org.apache.log,\ !org.apache.xml.resolver*,\ !org.bouncycastle.*,\ !org.gjt.xpp,\ !org.junit*,\ !org.relaxng.datatype,\ !org.xmlpull.v1,\ !com.graphbuilder*,\ *

Import-Package: \ !com.sun.*,\ !junit*,\ !org.apache.avalon.framework.logger,\ !org.apache.crimson.jaxp,\ !org.apache.jcp.xml.dsig.internal.dom,\ !org.apache.log,\ !org.apache.xml.resolver*,\ !org.bouncycastle.*,\ !org.gjt.xpp,\ !org.junit*,\ !org.relaxng.datatype,\ !org.xmlpull.v1,\ !com.graphbuilder*,\ *

一旦您在给定文件中添加了这些属性.该模块将成功部署并轻松将ApachePOI集成到Liferay DXP中.

once you added these properties in given files. module will deploy successfully and easily integrate ApachePOI into Liferay DXP.

这篇关于如何将Liferay DXP与Apache POI集成?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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