java MAVEN BUILD FAILURE - 无法解析项目 XYZ 的依赖关系
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26966862/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
MAVEN BUILD FAILURE - Could not resolve dependencies for project XYZ
提问by VdeX
I am integrating jersey and spring, for which I have following dependencies, but I am unable to build due to following error:
我正在集成 jersey 和 spring,我有以下依赖项,但由于以下错误我无法构建:
My POM file:
我的 POM 文件:
<dependencies>
<!-- Jersey -->
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.8</version>
</dependency>
<!-- Spring 3 dependencies -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
<!-- Jersey + Spring -->
<dependency>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>jersey-spring</artifactId>
<version>1.8</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
CONSOLE SCREEN SAYS:
控制台屏幕说:
Failed to execute goal on project SpringRestMavenCalc: Could not resolve dependencies for projectSpringRestMavenCalc:SpringRestMavenCalc:war:0.0.1-SNAPSHOT: Failed to collect dependencies for [com.sun.jersey:jersey-server:jar:1.8 (compile), org.springframework:spring-core:jar:3.0.5.RELEASE (compile), org.springframework:spring-context:jar:3.0.5.RELEASE (compile), org.springframework:spring-web:jar:3.0.5.RELEASE (compile), com.sun.jersey.contribs:jersey-spring:jar:1.8 (compile)]: No versions available for org.springframework:spring-aop:jar:[2.5.2,3) within specified range-> [Help 1]
无法在项目 SpringRestMavenCalc 上执行目标:无法解决项目SpringRestMavenCalc:SpringRestMavenCalc:war:0.0.1-SNAPSHOT:无法收集 [com.sun.jersey:jersey-server:jar:1.8 (compile), org 的依赖项的依赖项.springframework:spring-core:jar:3.0.5.RELEASE (编译), org.springframework:spring-context:jar:3.0.5.RELEASE (编译), org.springframework:spring-web:jar:3.0.5 .RELEASE (compile), com.sun.jersey.contribs:jersey-spring:jar:1.8 (compile)]:指定范围内没有适用于 org.springframework:spring-aop:jar:[2.5.2,3) 的版本-> [帮助 1]
Is this versions problem ?
这个版本有问题吗?
采纳答案by VdeX
Thanks All for your answers, Learnt lot from your answers.
谢谢大家的回答,从你的回答中学到了很多。
BUT FOLLOWING CHANGE IN MY POM MADE MY CODE RUN:
但是在我的 POM 发生变化后,我的代码运行了:
Addition of ,
外加的 ,
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
</exclusion>
回答by Prasad Khode
try adding maven dependency for spring-aop with the below:
尝试使用以下内容为 spring-aop 添加 maven 依赖项:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>2.5.2</version>
</dependency>
or
或者
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
i guess one of this should work
我想其中之一应该有效
回答by Haim Raman
No versions available for org.springframework:spring-aop:jar:[2.5.2,3)
没有适用于 org.springframework:spring-aop:jar:[2.5.2,3) 的版本
Meaning jersey-spring needs spring-aop 2.5<= version < 3
意思是 jersey-spring 需要spring-aop 2.5<= version < 3
So jersey-spring 1.8 and spring 3.0.5 are incompatible
所以 jersey-spring 1.8 和 spring 3.0.5 不兼容
I would try the following:
我会尝试以下方法:
- Look for newer version of jersey-spring that works with spring 3.0.5. Maybe jersey-spring3 as suggested by peeskilletabove.
- Try my luck with spring 3.0.5 by adding exclusions to jersey-spring dependency. Consult the pom hereand including them with version 3.0.5 if needed.
- 寻找适用于 spring 3.0.5 的较新版本的 jersey-spring。也许是上面peeskillet建议的jersey-spring3 。
- 通过向 jersey-spring 依赖项添加排除项来试试我的 spring 3.0.5 运气。请在此处查阅 pom ,并在需要时将它们包含在 3.0.5 版中。