2017-08-16 106 views
0

在我的pom.xml中我已經定義了一個依賴這樣繼承的Maven的依賴版本

<dependencies> 
    <dependency> 
     <groupId>org.springframework.data</groupId> 
     <artifactId>spring-data-jpa</artifactId> 
    </dependency> 
    </dependencies> 

沒有指定明確這種依賴的版本。但是,它的工作原理和我有版本1.8.2.RELEASE

我知道這可能是因爲繼承而造成的mvn help:effective-pom,我可以看到spring-data-jpa的有效版本號。但是我檢查了父pom,我沒有找到spring-data-jpa版本號的任何定義。

我怎麼能知道其中POM文件 maven已經拿起版本spring-data-jpa上去的時候繼承樹的遺傳?有沒有一個maven的命令?

MVN dependecy:樹輸出是這樣的:

[INFO] +- org.hibernate:hibernate-envers:jar:4.2.18.Final:provided 
[INFO] +- org.springframework.data:spring-data-jpa:jar:1.8.2.RELEASE:compile 
[INFO] | +- org.springframework.data:spring-data-commons:jar:1.10.2.RELEASE:compile 
[INFO] | +- org.springframework:spring-orm:jar:4.0.9.RELEASE:compile 
[INFO] | | \- org.springframework:spring-jdbc:jar:4.0.9.RELEASE:compile 
[INFO] | +- org.springframework:spring-aop:jar:4.1.7.RELEASE:compile 
[INFO] | | \- aopalliance:aopalliance:jar:1.0:compile 
[INFO] | +- org.springframework:spring-tx:jar:4.0.9.RELEASE:compile 
[INFO] | +- org.aspectj:aspectjrt:jar:1.8.6:compile 
[INFO] | \- org.slf4j:jcl-over-slf4j:jar:1.7.12:runtime 
[INFO] +- org.springframework.data:spring-data-envers:jar:1.0.8.RELEASE:compile 
[INFO] | \- joda-time:joda-time:jar:2.8.2:compile 

但在這個輸出沒有相關的POM文件,所以我不知道從哪個POM文件的版本推導。

回答

0

運行:mvn dependency:tree在命令行,你會看到在樹上所有的依賴,所以你知道在哪裏依賴來自

它看起來像:

[INFO] [dependency:tree] 
2.[INFO] org.apache.maven.plugins:maven-dependency-plugin:maven-plugin:2.0-alpha-5-SNAPSHOT 
3.[INFO] +- org.apache.maven.reporting:maven-reporting-impl:jar:2.0.4:compile 
4.[INFO] | \- commons-validator:commons-validator:jar:1.2.0:compile 
5.[INFO] |  \- commons-digester:commons-digester:jar:1.6:compile 
6.[INFO] |  \- (commons-collections:commons-collections:jar:2.1:compile - omitted for conflict with 2.0) 
7.[INFO] \- org.apache.maven.doxia:doxia-site-renderer:jar:1.0-alpha-8:compile 
8.[INFO] \- org.codehaus.plexus:plexus-velocity:jar:1.1.3:compile 
9.[INFO]  \- commons-collections:commons-collections:jar:2.0:compile 

有關的依賴插件的更多信息看到documentation

+0

謝謝,但我看不到哪個POM文件已定義'spring-data-jpa'的版本(1.8.2.RELEASE)。 –

+0

@Gab是好人你可以在你的問題中顯示評論的輸出內容嗎?做oyu有一個春天pom作爲父母pom嗎? – Jens

+0

我有一個spring pom作爲父pom,但是我沒有在其中找到'spring-data-jpa'版本的任何定義。 –