为什么Maven下载不同版本的Spring构件? [英] Why does Maven download different versions of Spring artifacts?

查看:71
本文介绍了为什么Maven下载不同版本的Spring构件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Maven项目中,我定义了一堆Spring依赖项,并且我注意到,在某些情况下,即使在pom.xml中指定了相同的版本,它们也会选择不同版本的工件.

In my Maven project I have defined a bunch of Spring dependencies, and I notice that in some cases it will choose different versions of the artifacts even though they are specified identically in my pom.xml.

这是mvn dependency:tree

[INFO] com.vrutberg.blogping:blogping:war:1.0-SNAPSHOT
[INFO] +- junit:junit:jar:4.7:test
[INFO] +- javax.servlet:servlet-api:jar:2.4:compile
[INFO] +- com.sun.jersey:jersey-server:jar:1.12:compile
[INFO] |  +- asm:asm:jar:3.1:compile
[INFO] |  \- com.sun.jersey:jersey-core:jar:1.12:compile
[INFO] +- com.sun.jersey:jersey-bundle:jar:1.12:compile
[INFO] +- javax.ws.rs:jsr311-api:jar:1.1.1:compile
[INFO] +- org.springframework:spring-core:jar:3.0.0.RC3:compile
[INFO] +- org.springframework:spring-expression:jar:3.0.5.RELEASE:compile
[INFO] +- org.springframework:spring-beans:jar:3.0.0.RC3:compile
[INFO] +- org.springframework:spring-aop:jar:3.0.0.RC3:compile
[INFO] +- org.springframework:spring-context:jar:3.0.0.RC3:compile
[INFO] +- org.springframework:spring-context-support:jar:3.0.5.RELEASE:compile
[INFO] +- org.springframework:spring-tx:jar:3.0.5.RELEASE:compile
[INFO] |  \- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- org.springframework:spring-orm:jar:3.0.5.RELEASE:compile
[INFO] |  \- org.springframework:spring-jdbc:jar:3.0.5.RELEASE:compile
[INFO] +- org.springframework:spring-oxm:jar:3.0.5.RELEASE:compile
[INFO] +- org.springframework:spring-web:jar:3.0.0.RC3:compile
[INFO] +- org.springframework:spring-webmvc:jar:3.0.5.RELEASE:compile
[INFO] |  \- org.springframework:spring-asm:jar:3.0.5.RELEASE:compile
[INFO] +- org.springframework:spring-test:jar:3.0.5.RELEASE:test
[INFO] \- com.sun.jersey.contribs:jersey-spring:jar:1.12:compile
[INFO]    \- com.sun.jersey:jersey-servlet:jar:1.12:compile

在我的pom.xml中,我定义了一个在所有Spring工件上使用的属性,其定义如下:

In my pom.xml I have defined a property which I use on all Spring artifacts, and it's defined like so:

<org.springframework.version>3.0.5.RELEASE</org.springframework.version>

这些是我的依赖项:

    <!-- spring libraries -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-expression</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-beans</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-aop</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context-support</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-tx</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-orm</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-oxm</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-test</artifactId>
        <version>${org.springframework.version}</version>
        <scope>test</scope>
    </dependency>

为什么它会使用不同的版本?

Why on earth does it use different versions?

好的,所以我刚刚发现了这些警告.我想这与它有关:

Okay, so I just discovered these warnings. I suppose this has something to do with it:

Downloading: http://download.java.net/maven/2/org/springframework/spring-core/3.0.0.RC3/spring-core-3.0.0.RC3.pom
Downloading: http://repo1.maven.org/maven2/org/springframework/spring-core/3.0.0.RC3/spring-core-3.0.0.RC3.pom
[WARNING] Missing POM for org.springframework:spring-core:jar:3.0.5.RELEASE
Downloading: http://download.java.net/maven/2/org/springframework/spring-beans/3.0.0.RC3/spring-beans-3.0.0.RC3.pom
Downloading: http://repo1.maven.org/maven2/org/springframework/spring-beans/3.0.0.RC3/spring-beans-3.0.0.RC3.pom
[WARNING] Missing POM for org.springframework:spring-beans:jar:3.0.5.RELEASE
Downloading: http://download.java.net/maven/2/org/springframework/spring-aop/3.0.0.RC3/spring-aop-3.0.0.RC3.pom
Downloading: http://repo1.maven.org/maven2/org/springframework/spring-aop/3.0.0.RC3/spring-aop-3.0.0.RC3.pom
[WARNING] Missing POM for org.springframework:spring-aop:jar:3.0.5.RELEASE
Downloading: http://download.java.net/maven/2/org/springframework/spring-context/3.0.0.RC3/spring-context-3.0.0.RC3.pom
Downloading: http://repo1.maven.org/maven2/org/springframework/spring-context/3.0.0.RC3/spring-context-3.0.0.RC3.pom
[WARNING] Missing POM for org.springframework:spring-context:jar:3.0.5.RELEASE
Downloading: http://download.java.net/maven/2/org/springframework/spring-web/3.0.0.RC3/spring-web-3.0.0.RC3.pom
Downloading: http://repo1.maven.org/maven2/org/springframework/spring-web/3.0.0.RC3/spring-web-3.0.0.RC3.pom
[WARNING] Missing POM for org.springframework:spring-web:jar:3.0.5.RELEASE

为什么某些文物缺少绒球?为什么它又退回到使用3.0.0.RC3?

Why are the poms missing for some artifacts though? And why does it fall back to using 3.0.0.RC3?

推荐答案

在eclipse中,至少在上一个版本中,有一个pom视图,您可以在其中查看依赖项树,以便找出为什么将库添加为其他图书馆的便利.

In eclipse, at least in the last version, there is a pom view where you can see the dependency tree so you can find out why a library is added as a consecuence of other library.

这篇关于为什么Maven下载不同版本的Spring构件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆