我有一个父项目,有 5 个孩子,彼此之间也有依赖关系。<parent>
我在子 pom.xml 中使用了元素的继承和<module>
父元素中的聚合。
我的父母 pom 看起来像这样:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.domain</groupId>
<artifactId>Parent</artifactId>
<packaging>pom</packaging>
<version>RELEASE</version>
<name>Parent</name>
<modules>
<module>../Child1</module>
<module>../Child2</module>
<module>../Child3</module>
<module>../Child4</module>
<module>../Child5</module>
</modules>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.domain</groupId>
<artifactId>Child1</artifactId>
<version>RELEASE</version>
</dependency>
<dependency>
<groupId>com.domain</groupId>
<artifactId>Child2</artifactId>
<version>RELEASE</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
Child3 pom 看起来像这样:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.domain</groupId>
<artifactId>Child3</artifactId>
<name>Child3</name>
<packaging>war</packaging>
<parent>
<artifactId>Parent</artifactId>
<groupId>com.domain</groupId>
<version>RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>com.domain</groupId>
<artifactId>Child1</artifactId>
</dependency>
<dependency>
<groupId>com.domain</groupId>
<artifactId>Child2</artifactId>
</dependency>
</dependencies>
</project>
当我mvn install
在 Parent 或 Child1 上运行时,一切正常。但是当我在 Child3 上运行它时,出现以下错误:
[INFO] Failed to resolve artifact.
Missing:
----------
1) com.domain:Child1:jar:RELEASE
...
2) com.domain:Child2:jar:RELEASE
我的设置有什么问题?