2013-05-01 109 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