在maven依赖项中包含一个不同版本的库完全破坏了我的构建
所以我有在maven依赖项中包含一个不同版本的库完全破坏了我的构建,maven,jackson,versioning,spring-social,Maven,Jackson,Versioning,Spring Social,所以我有 <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-jaxrs</artifactId> <version>1.8.3</version> <scope>${defaultScope}</scop
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-jaxrs</artifactId>
<version>1.8.3</version>
<scope>${defaultScope}</scope>
</dependency>
org.codehaus.jackson
杰克逊·贾克斯
1.8.3
${defaultScope}
我包括了这个
<dependency>
<groupId>org.springframework.social</groupId>
<artifactId>spring-social-web</artifactId>
<version>1.0.2.RELEASE</version>
</dependency>
org.springframework.social
spring社交网站
1.0.2.1发布
它本身就包括这个
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.3</version>
<scope>test</scope>
</dependency>
org.codehaus.jackson
杰克逊地图绘制者
1.9.3
测试
这导致没有为jsonwrapper找到任何类
我更新了我的jackson dependency的原始版本,使之与spring social included版本保持一致,现在可以正常工作了
这看起来相当脆弱/不友好,我应该做些什么来避免这些问题吗?您可以使用
mvn dependency:tree -Dverbose
在你的情况下,它叫道:
+- org.codehaus.jackson:jackson-jaxrs:jar:1.8.3:compile
| +- org.codehaus.jackson:jackson-core-asl:jar:1.8.3:compile
| \- org.codehaus.jackson:jackson-mapper-asl:jar:1.8.3:compile
| \- (org.codehaus.jackson:jackson-core-asl:jar:1.8.3:compile - omitted for duplicate)
\- org.springframework.social:spring-social-web:jar:1.0.2.RELEASE:compile
+- org.springframework:spring-webmvc:jar:3.1.0.RELEASE:compile
| +- org.springframework:spring-asm:jar:3.1.0.RELEASE:compile
| +- org.springframework:spring-beans:jar:3.1.0.RELEASE:compile
| | \- (org.springframework:spring-core:jar:3.1.0.RELEASE:compile - omitted for duplicate)
| +- org.springframework:spring-context:jar:3.1.0.RELEASE:compile
| | +- org.springframework:spring-aop:jar:3.1.0.RELEASE:compile
| | | +- (aopalliance:aopalliance:jar:1.0:compile - omitted for duplicate)
| | | +- (org.springframework:spring-asm:jar:3.1.0.RELEASE:compile - omitted for duplicate)
| | | +- (org.springframework:spring-beans:jar:3.1.0.RELEASE:compile - omitted for duplicate)
| | | \- (org.springframework:spring-core:jar:3.1.0.RELEASE:compile - omitted for duplicate)
| | +- (org.springframework:spring-beans:jar:3.1.0.RELEASE:compile - omitted for duplicate)
| | +- (org.springframework:spring-core:jar:3.1.0.RELEASE:compile - omitted for duplicate)
| | +- (org.springframework:spring-expression:jar:3.1.0.RELEASE:compile - omitted for duplicate)
| | \- (org.springframework:spring-asm:jar:3.1.0.RELEASE:compile - omitted for duplicate)
| +- org.springframework:spring-context-support:jar:3.1.0.RELEASE:compile
| | +- (org.springframework:spring-beans:jar:3.1.0.RELEASE:compile - omitted for duplicate)
| | +- (org.springframework:spring-context:jar:3.1.0.RELEASE:compile - omitted for duplicate)
| | \- (org.springframework:spring-core:jar:3.1.0.RELEASE:compile - omitted for duplicate)
| +- org.springframework:spring-core:jar:3.1.0.RELEASE:compile
| | +- (org.springframework:spring-asm:jar:3.1.0.RELEASE:compile - omitted for duplicate)
| | \- commons-logging:commons-logging:jar:1.1.1:compile
| +- org.springframework:spring-expression:jar:3.1.0.RELEASE:compile
| | \- (org.springframework:spring-core:jar:3.1.0.RELEASE:compile - omitted for duplicate)
| \- (org.springframework:spring-web:jar:3.1.0.RELEASE:compile - omitted for duplicate)
+- javax.inject:javax.inject:jar:1:compile
+- org.springframework:spring-web:jar:3.1.0.RELEASE:compile
| +- aopalliance:aopalliance:jar:1.0:compile
| +- (org.springframework:spring-beans:jar:3.1.0.RELEASE:compile - omitted for duplicate)
| +- (org.springframework:spring-context:jar:3.1.0.RELEASE:compile - omitted for duplicate)
| \- (org.springframework:spring-core:jar:3.1.0.RELEASE:compile - omitted for duplicate)
\- org.springframework.social:spring-social-core:jar:1.0.2.RELEASE:compile
\- (org.springframework:spring-web:jar:3.1.0.RELEASE:compile - omitted for duplicate)
据我所知,并不是
spring社交网站
包含jackson mapper asl
您可以使用
部分告诉Maven忽略可传递依赖项:
<dependency>
<groupId>org.springframework.social</groupId>
<artifactId>spring-social-web</artifactId>
<version>1.0.2.RELEASE</version>
<exclusions>
<exclusion>
<artifactId>org.codehaus.jackson</artifactId>
<groupId>jackson-mapper-asl</groupId>
</exclusion>
</exclusions>
</dependency>
org.springframework.social
spring社交网站
1.0.2.1发布
org.codehaus.jackson
杰克逊地图绘制者
有了这个定义,Maven将只使用您先前定义的依赖项(1.8.3版本)。但请注意,有时这可能会导致其他问题,例如SpringSocialWeb可能会使用1.8.3版本中不存在的功能