我在父pom的配置文件中有4个具有相同范围的依赖项,我将在子项目中使用它,但事实证明,4个依赖项中有3个是继承的,但其中一个不是。
父pom是
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>XXXX</groupId>
<artifactId>XX-XXX-XXXXX</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
........{not relevent}
<profiles>
<profile>
<id>another.profile</id>
<activebydefault>true</activebydefault>
<....a plugin dependency....>
</profile>
<profile>
<id>pro1</id>
<dependencies>
<dependency>
<groupId>group1</groupId>
<artifactId>arti1</artifactId>
<version>${arti1.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>group2</groupId>
<artifactId>arti2</artifactId>
<version>${arti2.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>group3</groupId>
<artifactId>arti3</artifactId>
<version>${arti3.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>group4</groupId>
<artifactId>arti4</artifactId>
<version>${arti4.version}</version>
<scope>compile</scope>
</dependency>
</profile>
</project>
孩子pom是
4.0.0
<groupId>XXXXX</groupId>
<artifactId>XX-XXX-XXXXX</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<dependency>
<groupId>group3</groupId>
<artifactId>arti3</artifactId>
<version>${arti3.version}</version>
<scope>provided</scope>
</dependency>
</project>
然后我尝试在子项目中使用此配置文件,在运行mvn -Ppro1 dependency:tree
后,我找不到<artifactId>arti3</artifactId>
的依赖项
maven版本3.5.3