Jersey Jackson和codehaus vs. fasterxml [英] Jersey Jackson and codehaus vs. fasterxml
问题描述
我正在使用Jersey 1.17.1和Jackson 2.2.1。
I'm using Jersey 1.17.1 with Jackson 2.2.1.
好像杰克逊将包裹从 org.codehaus
转换为 com.fasterxml
。我已正确配置所有代码并使用最新的jackson。然而,看起来泽西仍然在拉 org.codehaus.jackson
。有没有办法缓解这个问题,或者我应该坚持使用 codehaus
包,直到泽西升级为使用 fasterxml
包?
It seems like Jackson switched packages from org.codehaus
to com.fasterxml
. I have all my code configured properly and using the latest jackson. However, it seems like Jersey is still pulling in org.codehaus.jackson
. Is there any way to mitigate this or should I stick with the codehaus
packages until jersey is upgraded to use the fasterxml
packages?
推荐答案
较旧的杰克逊库作为jersey-json 神器。当
The older Jackson libraries are being pulled in as dependencies of the jersey-json artifact. When
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-json</artifactId>
<version>1.17</version>
</dependency>
包含在您的POM中,您将自动获得包含在您的POM中的org.codehaus.jackson库的版本项目。不幸的是,jersey-json本身对Jackson类有链接时间依赖性,所以你不能简单地使用排除的。你想要做的是完全省略它。它实际上是一种围绕一堆你不一定需要的JSON库的包装器库。删除后,您可以为Jackson 2.2.1库和JAX-RS提供程序添加依赖项:
is included in your POM you will automatically get versions of the org.codehaus.jackson libraries included in your project. Unfortunately, jersey-json itself has link time dependencies on the Jackson classes, so you can't simply use exclusions. What you want do to instead is omit it entirely. It's really a kind of wrapper library around a bunch of JSON libraries that you do not necessarily need. Once removed, you can add dependencies for the Jackson 2.2.1 libraries and JAX-RS provider:
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>2.2.1</version>
</dependency>
请注意,删除了jersey-json后,您不再拥有Stax2,Jettison或JAXB提供程序。如果您需要那些,那么您将不得不手动找到并添加依赖项。
Note that with jersey-json removed you no longer have a Stax2, Jettison, or JAXB provider. If you need those then you will have to locate and add dependencies for them manually.
这篇关于Jersey Jackson和codehaus vs. fasterxml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!