2013-05-01 76 views
0

设置为3.2.1.RELEASE在POM,但不同的罐子在J​​ava项目的POM文件我已经设置为3.2.1.RELEASE版本的Spring的依赖,但是当我运行一个mvn dependency:tree我得到不同的版本,对于一些依赖关系:春季版项目

org.springframework:spring-core:jar:3.0.0.RC3:compile 
org.springframework:spring-expression:jar:3.2.1.RELEASE:compile 
org.springframework:spring-beans:jar:3.0.0.RC3:compile 
org.springframework:spring-context:jar:3.0.0.RC3:compile 
org.springframework:spring-test:jar:3.2.1.RELEASE:test 
com.sun.jersey.contribs:jersey-spring:jar:1.12:compile 
+- org.springframework:spring-web:jar:3.0.0.RC3:compile 
| \- aopalliance:aopalliance:jar:1.0:compile 
\- org.springframework:spring-aop:jar:3.0.0.RC3:compile 
    \- org.springframework:spring-asm:jar:3.0.0.RC3:compile 

奇怪的是,在其他项目,这也取决于春天3.2.1.RELEASE我真正得到我在POM文件中声明的denendencies。

任何想法为什么这个奇怪的事情发生?这可能是因为我有其他依赖关系吗?

编辑: 这里的POM文件

<!-- properties --> 
<properties> 
    <org.springframework.version>3.2.1.RELEASE</org.springframework.version> 
    <com.jersey.version>1.17</com.jersey.version> 
    <org.richfaces.version>4.1.0.Final</org.richfaces.version> 
    <jsf.api.version>2.1.7</jsf.api.version> 
    <powermock.version>1.5</powermock.version> 
</properties> 

<dependencies> 
    <!-- Spring --> 
    <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-context</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> 
    <!-- Jersey Spring --> 
    <dependency> 
     <groupId>com.sun.jersey.contribs</groupId> 
     <artifactId>jersey-spring</artifactId> 
     <version>1.12</version> 
    </dependency> 

    <!-- Jersey --> 
    <dependency> 
     <groupId>com.sun.jersey</groupId> 
     <artifactId>jersey-core</artifactId> 
     <version>${com.jersey.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>com.sun.jersey</groupId> 
     <artifactId>jersey-json</artifactId> 
     <version>${com.jersey.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>com.sun.jersey</groupId> 
     <artifactId>jersey-servlet</artifactId> 
     <version>${com.jersey.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>com.sun.jersey</groupId> 
     <artifactId>jersey-server</artifactId> 
     <version>${com.jersey.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>com.sun.jersey</groupId> 
     <artifactId>jersey-client</artifactId> 
     <version>${com.jersey.version}</version> 
    </dependency> 

    <!-- JSF --> 
    <dependency> 
     <groupId>javax.inject</groupId> 
     <artifactId>javax.inject</artifactId> 
     <version>1</version> 
    </dependency> 

    <dependency> 
     <groupId>com.sun.faces</groupId> 
     <artifactId>jsf-api</artifactId> 
     <version>${jsf.api.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>com.sun.faces</groupId> 
     <artifactId>jsf-impl</artifactId> 
     <version>${jsf.api.version}</version> 
    </dependency> 

    <!-- Servlet, JSP, JSTL --> 
    <dependency> 
     <groupId>javax.servlet</groupId> 
     <artifactId>servlet-api</artifactId> 
     <version>2.5</version> 
     <scope>provided</scope> 
    </dependency> 

    <dependency> 
     <groupId>javax.servlet</groupId> 
     <artifactId>jstl</artifactId> 
     <version>1.2</version> 
    </dependency> 

    <dependency> 
     <groupId>javax.servlet.jsp</groupId> 
     <artifactId>jsp-api</artifactId> 
     <version>2.1</version> 
    </dependency> 

    <!-- Tomcat 6 need this --> 
    <dependency> 
     <groupId>javax.el</groupId> 
     <artifactId>javax.el-api</artifactId> 
     <version>2.2.1</version> 
    </dependency> 

    <dependency> 
     <groupId>org.glassfish.web</groupId> 
     <artifactId>el-impl</artifactId> 
     <version>2.2</version> 
    </dependency> 

    <!-- Richfaces --> 
    <dependency> 
     <groupId>org.richfaces.ui</groupId> 
     <artifactId>richfaces-components-ui</artifactId> 
     <version>${org.richfaces.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>org.richfaces.core</groupId> 
     <artifactId>richfaces-core-impl</artifactId> 
     <version>${org.richfaces.version}</version> 
    </dependency> 

    <!-- Log4j --> 
    <dependency> 
     <groupId>log4j</groupId> 
     <artifactId>log4j</artifactId> 
     <version>1.2.15</version> 
     <exclusions> 
      <exclusion> 
       <groupId>javax.jms</groupId> 
       <artifactId>jms</artifactId> 
      </exclusion> 
      <exclusion> 
       <groupId>com.sun.jmx</groupId> 
       <artifactId>jmxri</artifactId> 
      </exclusion> 
      <exclusion> 
       <groupId>com.sun.jdmk</groupId> 
       <artifactId>jmxtools</artifactId> 
      </exclusion> 
     </exclusions> 
    </dependency> 
    <dependency> 
     <groupId>commons-logging</groupId> 
     <artifactId>commons-logging</artifactId> 
     <version>1.1.1</version> 
    </dependency> 

    <!-- Junit --> 
    <dependency> 
     <groupId>junit</groupId> 
     <artifactId>junit</artifactId> 
     <version>4.8.1</version> 
     <scope>test</scope> 
    </dependency> 

    <!-- powermock --> 
    <dependency> 
     <groupId>org.powermock</groupId> 
     <artifactId>powermock-module-junit4</artifactId> 
     <version>${powermock.version}</version> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.powermock</groupId> 
     <artifactId>powermock-api-mockito</artifactId> 
     <version>${powermock.version}</version> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.powermock</groupId> 
     <artifactId>powermock-api-easymock</artifactId> 
     <version>${powermock.version}</version> 
     <scope>test</scope> 
    </dependency> 

</dependencies> 
+0

我们可以看一下pom.xml文件? – blackpanther 2013-05-01 10:20:52

+0

@blackpanther,只是添加了pom内容。 – 2013-05-01 10:24:32

+0

您是否有''部分,可能在父POM中? – 2013-05-01 11:11:01

回答

1

我觉得这是很可能在你的项目中的另一个库对3.0.0.RC.依赖我最好的猜测是泽西春。尝试从下面排除所有相关的弹簧依赖关系,它应该选择你指定的版本。

`

<dependency> 
<groupId>com.sun.jersey.contribs</groupId> 
<artifactId>jersey-spring</artifactId> 
<version>1.12</version> 
<exclusions> 
    <exclusion> 
    <groupId>org.springframework</groupId> 
    <artifactId>spring-core</artifactId> 
</exclusion> 
..... 

`

+1

Maven通过选择依赖关系图中较近的依赖关系来解决版本冲突问题。因此'org.springframework:spring-core:3.2.1.RELEASE'应该胜过任何传递依赖。 – 2013-05-01 11:07:15

+0

@howiewylie我认为你是对的,我删除了jersey-spring依赖项,依赖树现在显示了3.2.1.RELEASE版本的spring – 2013-05-01 11:42:07