我的主项目的pom声明了hadoop-client的版本。依赖项声明hadoop-client的不同版本。实际上最终会使用哪一个?
我的主要项目的pom.xml:
<dependency>
<groupId>com.apache.hadoop</groupId>
<artifactId>hadoop-client</artifactId>
<version>2.7.0</version>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.myown.group</groupId>
<artifactId>my-own-artifact</artifactId>
<version>1.0.0</version>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
我的主要项目依赖的库的pom.xml:
<dependency>
<groupId>com.apache.hadoop</groupId>
<artifactId>hadoop-client</artifactId>
<version>2.5.0</version>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
答案 0 :(得分:3)
Maven has a complex set of rules for version resolution, summarized as 'nearest wins'. One source of details is this post here. You can find out what Maven decided by using mvn dependency:list
or mvn dependency:tree
.