httpbuilder和apache.poi.workbook maven问题
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了httpbuilder和apache.poi.workbook maven问题相关的知识,希望对你有一定的参考价值。
在Maven POM文件中,我有以下内容:
<dependency>
<groupId>org.codehaus.groovy.modules.http-builder</groupId>
<artifactId>http-builder</artifactId>
<version>0.7.1</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.2</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.5</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.17</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.17</version>
</dependency>
<dependency>
<groupId>stax</groupId>
<artifactId>stax</artifactId>
<version>1.2.0</version>
</dependency>
我想在我的项目中使用Httpbuilder
和Workbook
来解析Excel文件。
def res = http.post("path": "....", "requestContentType": JSON, contentType: ContentType.BINARY)
Workbook book = WorkbookFactory.create(res.responseData)
错误:
- 如果我使用我的Maven依赖项
java.lang.LinkageError: loader constraint violation in interface itable
initialization: when resolving method "org.apache.xerces.dom.NodeImpl
- 如果我向stax或httpbuilder添加排除
java.lang.NoSuchMethodError: javax.xml.parsers.DocumentBuilderFactory.setFeature(Ljava/lang/String;Z)V
- 如果我删除stax依赖项
javax.xml.stream.FactoryConfigurationError: Provider com.bea.xml.stream.EventFactory not found
关于如何使用HttpBuilder
与Workbook
的任何想法?
答案
从http-builder依赖项中排除xerces。在我的情况下,它解决了问题
<dependency>
<groupId>org.codehaus.groovy.modules.http-builder</groupId>
<artifactId>http-builder</artifactId>
<version>0.7.1</version>
<exclusions>
<exclusion>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
</exclusion>
</exclusions>
</dependency>
以上是关于httpbuilder和apache.poi.workbook maven问题的主要内容,如果未能解决你的问题,请参考以下文章