简体   繁体   English

泽西岛依赖冲突

[英]Jersey dependency conflict

I'm implementing a dropwizard server app on top of an existing project.我正在现有项目之上实现一个dropwizard服务器应用程序。 building with maven.用 Maven 构建。

I'm currently in jar hell, and it's not fun.我目前在罐子地狱,这并不好玩。 I have a pom file that's rather convoluted.我有一个相当复杂的 pom 文件。 I have a big problem with jersey dependencies packaged with hadoop/glassfish/com.sun.我对使用 hadoop/glassfish/com.sun 打包的球衣依赖项有一个大问题。 com.sun.jersey:jersey-core:jar1.19 is conflicting with org.glassfish.jersey.core:jersey-client:jar:2.22.2 . com.sun.jersey:jersey-core:jar1.19org.glassfish.jersey.core:jersey-client:jar:2.22.2 com.sun.jersey:jersey-core:jar1.19冲突。 I tried adding some exclusions to make it use the 2.22.x version, but it's still giving me the error seen here .我尝试添加一些排除项以使其使用2.22.x版本,但它仍然给我这里看到的错误。 I've been combing through the dependency tree and adding exclusions where I see fit, but can't seem to get it right.我一直在梳理依赖关系树并在我认为合适的地方添加排除项,但似乎无法做到正确。 Here is my pom file .这是我的pom 文件

Personal experience tells me that you should check ALL your dependencies (especially the ones you developed in-house) if you have the old jersey version as a dependency in there.个人经验告诉我,如果您有旧的 jersey 版本作为依赖项,您应该检查所有依赖项(尤其是您内部开发的依赖项)。

That's what solved a similiar problem for me.这就是为我解决类似问题的原因。

If you do :如果你这样做:

mvn dependency:list -Dverbose (grep for filtering results) mvn dependency:list -Dverbose (grep 用于过滤结果)

it gives u the list of dependencies(transitive ones also).Check the version of sun jersey or glassfish jersey that's being used in your application.它为您提供依赖项列表(也可以传递依赖项)。检查您的应用程序中使用的 sun jersey 或 glassfish jersey 的版本。

If you do :如果你这样做:

mvn dependency:tree -Dverbose -Dincludes=jersey-server mvn 依赖项:tree -Dverbose -Dincludes=jersey-server

you will see the graph of where any version of jersey-server is coming from a parent.您将看到任何版本的 jersey-server 来自父级的图表。

I had a hadoop-client and an in-house rest-bus-client using a version of sun jersey(1.9.x) which i needed to remove.我有一个 hadoop-client 和一个内部 rest-bus-client 使用我需要删除的 sun jersey(1.9.x) 版本。 I tried in maven and it simply worked.我在 maven 中尝试过,它很有效。

Also, this jersey version unmatch caused the following issue for me in dropwizard.此外,此球衣版本不匹配导致我在 dropwizard 中出现以下问题。

java.lang.NoSuchMethodError: javax.ws.rs.core.Application.getProperties()Ljava/util/Map; java.lang.NoSuchMethodError: javax.ws.rs.core.Application.getProperties()Ljava/util/Map;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM