经过大量调查,我找到了 Liferay DXP 和 Apache POI 集成的解决方案和正确的依赖关系管理。
在 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'
在 bnd.bnd 文件中添加以下属性
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*,\
*
在给定文件中添加这些属性后。模块将成功部署并轻松将 ApachePOI 集成到 Liferay DXP。