转自:/questions/26021141/maven-child-module-does-not-exist
1)在maven项目Parent中的 pom.xml 中 使用聚合安装多个 maven工程到本地仓库,pom配置如下:
<project xmlns="/POM/4.0.0" xmlns:xsi="/2001/XMLSchema-instance" xsi:schemaLocation="/POM/4.0.0 /xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>com.atguigu.maven</groupId><artifactId>Parent</artifactId><version>0.0.1-SNAPSHOT</version><packaging>pom</packaging><modules><module>../Hello</module><module>../HelloFriend</module><module>../OutFriends</module><module>../MakeFriends</module></modules>
右键该pom.xml 执行 mvn install , 报错信息如下:
[INFO] Scanning for projects...[ERROR] [ERROR] Some problems were encountered while processing the POMs:[ERROR] Child module E:\bench-cluster\spring_in_action_eclipse\Parent\..\Hello of E:\bench-cluster\spring_in_action_eclipse\Parent\pom.xml does not exist @ [ERROR] Child module E:\bench-cluster\spring_in_action_eclipse\Parent\..\HelloFriend of E:\bench-cluster\spring_in_action_eclipse\Parent\pom.xml does not exist @
解决方法是:使用如下聚合配置
<!-- 通过modules 声明聚合安装的工程名称 ,然后统一install,且工程间的放置顺序可以随意 --> <profiles><profile><modules><module>../Hello</module><module>../HelloFriend</module><module>../OutFriends</module><module>../MakeFriends</module></modules></profile></profiles>
最后 pom.xml 右键 -> maven install 安装成功。 bingo。