2010-04-07 66 views
0

我試着做一個mvn dependency:tree,我得到一個依賴關係樹。如何將所有依賴關係升級到特定版本

我的問題是,我的項目取決於許多內部依賴於許多春天工件的模塊。有幾個版本衝突。我想升級所有春天相關的圖書館來說最新的(2.6.x或更高版本)。什麼是這樣做的首選方式?

我應該在我的pom.xml中聲明所有deps spring-context,spring-support(和其他10個工件)並將它們指向2.6.x?還有其他更好的方法嗎?

[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 

UPDATE:我已刪除多餘的問題,關於「\ - 」所以我的問題是,現在什麼主題詢問:)

+0

如果您有兩個單獨的問題,請分兩個單獨的帖子!這兩個問題似乎完全不相關(除了它們都是關於maven的事實之外)。 – 2010-04-07 09:04:43

+0

廣告更新:通過簡單地刪除'\ -'部分,您可以有效地做出兩個現有答案。這不是最好的方式。你可能*應該*將現在剩下的部分移到新的questiton中,並在這裏留下原始問題。那麼,你生活和學習。 – 2010-04-07 09:12:31

回答

2

解決辦法有兩個:

  1. 的OSS方式:下載你所依賴的項目,它們遷移到最新版本Spring並給它們發送補丁,以便每個人都獲得新功能

  2. 覆蓋您自己的POM中每個依賴項的版本。

3

該子樹的結束。沒有什麼比ASCII藝術的花哨一點 - 認爲好像它的+ -

+0

我不認爲這是真正的問題;-) – 2010-04-07 08:57:31

+0

Yuck :)那麼是否有任何快捷方式將所有彈簧相關的工件升級到一個版本?我不想列出所有的10個春天,並指出它的版本。 – 2010-04-07 08:57:42

2

你看過dependecyManagement標籤嗎?它允許你指定父POM的每個依賴項的版本號。那麼你的所有其他勁歌可以繼承指定的版本:

<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

相關問題