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

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

问题描述

我正在尝试在 Liferay DXP(OSGi) 中集成 Apache POI,但无法在 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 :

  • 编译组:'org.apache.commons',名称:'commons-collections4',版本:'4.1'
  • 编译组:'org.apache.commons',名称:'commons-lang3',版本:'3.4'
  • 编译组:'org.apache.poi',名称:'poi',版本:'3.17'
  • 编译组:'org.apache.poi',名称:'poi-excelant',版本:'3.17'
  • 编译组:'org.apache.poi',名称:'poi-ooxml',版本:'3.17'
  • 编译组:'org.apache.poi',名称:'poi-ooxml-schemas',版本:'3.17'
  • 编译组:'org.apache.poi',名称:'poi-scratchpad',版本:'3.17'
  • 编译组:'org.apache.poi',名称:'ooxml-schemas',版本:'1.3'
  • 编译组:'org.apache.poi',名称:'ooxml-security',版本:'1.1'
  • 编译组:'org.apache.xmlbeans',名称:'xmlbeans',版本:'2.6.0'

在 bnd.bnd 文件中添加以下属性

Add below Properties in bnd.bnd file

包含资源:\@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

导入包:\!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天全站免登陆