gpt4 book ai didi

java - cxf Spring Maven依赖冲突

转载 作者:太空宇宙 更新时间:2023-11-04 08:04:04 25 4
gpt4 key购买 nike

我们的项目正在使用以下 cxf 依赖项:

    <dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-bundle</artifactId>
</dependency>

我们正在使用最新的cxf 2.6.1。但是,cxf-bundle lib 依赖于 Spring 3.0.7.RELEASE libs,这与我们的 Spring 3.1.2.RELEASE libs 冲突,而后者是理解基于注释的 ORM 配置类所必需的。

有没有人有好的解决方案来解决这个问题?

最佳答案

要将 Spring 依赖项解析为您所需的版本,必须在您的 pom 中明确设置它们,如下所示:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>lorem</groupId>
<artifactId>ipsum</artifactId>
<version>0.0.1-SNAPSHOT</version>

<dependencies>

<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-core</artifactId>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-bundle</artifactId>
<version>2.6.1</version>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>3.1.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-asm</artifactId>
<version>3.1.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>3.1.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.1.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.1.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>3.1.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jms</artifactId>
<version>3.1.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>3.1.2.RELEASE</version>
</dependency>

</dependencies>

</project>

这将解决:

...
[INFO] org.springframework:spring-aop:jar:3.1.2.RELEASE:compile
[INFO] org.springframework:spring-asm:jar:3.1.2.RELEASE:compile
[INFO] org.springframework:spring-beans:jar:3.1.2.RELEASE:compile
[INFO] org.springframework:spring-context:jar:3.1.2.RELEASE:compile
[INFO] org.springframework:spring-core:jar:3.1.2.RELEASE:compile
[INFO] org.springframework:spring-expression:jar:3.1.2.RELEASE:compile
[INFO] org.springframework:spring-jms:jar:3.1.2.RELEASE:compile
[INFO] org.springframework:spring-tx:jar:3.1.2.RELEASE:compile
...

为什么依赖cxf-bundle?您是否在 OSGi 环境中运行?

cxf-bundle 导入包

 org.springframework*;resolution:=optional;version="[2.5,4)"

容器中部署最新的Spring版本应该没问题(至少我会尝试一下)。

关于java - cxf Spring Maven依赖冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12358120/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com