首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何将所有依赖项升级到特定版本

如何将所有依赖项升级到特定版本
EN

Stack Overflow用户
提问于 2010-04-07 16:54:12
回答 3查看 157关注 0票数 0

我试着做一个mvn dependency:tree,我得到了一个依赖关系树。

我的问题是,我的项目依赖于许多模块,而这些模块内部依赖于许多spring工件。有一些版本冲突。我想升级所有与spring相关的库,比如最新的(2.6.x或更高版本)。执行此操作的首选方法是什么?

我是否应该在我的pom.xml中声明所有的dep spring-context,spring-support (和其他10个工件),并将它们指向2.6.x?有没有其他更好的方法?

代码语言:javascript
复制
[INFO] +- com.xxxx:yyy-jar:jar:1.0-SNAPSHOT:compile
[INFO] |  +- com.xxxx:zzz-commons:jar:1.0-SNAPSHOT:compile
[INFO] |  |  +- org.springframework:spring-dao:jar:2.0.7:compile
[INFO] |  |  +- org.springframework:spring-jdbc:jar:2.0.7:compile
[INFO] |  |  +- org.springframework:spring-web:jar:2.0.7:compile
[INFO] |  |  +- org.springframework:spring-support:jar:2.0.7:compile
[INFO] |  |  +- net.sf.ehcache:ehcache:jar:1.2:compile
[INFO] |  |  +- commons-collections:commons-collections:jar:3.2:compile
[INFO] |  |  +- aspectj:aspectjweaver:jar:1.5.3:compile
[INFO] |  |  +- betex-commons:betex-commons:jar:5.5.1-2:compile
[INFO] |  |  \- javax.servlet:servlet-api:jar:2.4:compile
[INFO] |  +- org.springframework:spring-beans:jar:2.0.7:compile
[INFO] |  +- org.springframework:spring-jmx:jar:2.0.7:compile
[INFO] |  +- org.springframework:spring-remoting:jar:2.0.7:compile
[INFO] |  +- org.apache.cxf:cxf-rt-core:jar:2.0.2-incubator:compile
[INFO] |  |  +- org.apache.cxf:cxf-api:jar:2.0.2-incubator:compile
[INFO] |  |  |  +- org.apache.geronimo.specs:geronimo-activation_1.1_spec:jar:1.0-M1:compile
[INFO] |  |  |  +- org.codehaus.woodstox:wstx-asl:jar:3.2.1:compile
[INFO] |  |  |  +- org.apache.neethi:neethi:jar:2.0.2:compile
[INFO] |  |  |  \- org.apache.cxf:cxf-common-schemas:jar:2.0.2-incubator:compile

更新:我已经删除了关于"-“的额外问题,所以我的问题现在是主题所要求的:)

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2010-04-07 17:19:56

有两种解决方案:

Spring的开源方式:下载你所依赖的项目,将它们迁移到最新版本的,并给他们发送一个补丁,这样每个人都可以获得新的features

  1. Overwrite,即你自己的POM中每个依赖项的版本。
票数 2
EN

Stack Overflow用户

发布于 2010-04-07 16:56:17

子树的末尾。只不过是一些华丽的ascii艺术-想想它的+-

票数 3
EN

Stack Overflow用户

发布于 2010-04-07 18:44:46

你看过dependecyManagement标签了吗?它允许您指定每个依赖项的版本号作为父pom。然后,所有其他pom都可以继承指定的版本:

代码语言:javascript
复制
<properties>
    <spring.version>2.5.6</spring.version>
</properties>
...
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <!-- more dependencies -->

    </dependencies>
</dependencyManagement>

有关更多信息,请访问Introduction to the Dependency Mechanism

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/2591069

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档