问题
聚合Maven工程执行编译打包出现 Non-resolvable parent POM for ...找不到父POM异常
Non-resolvable parent POM for com.digipower:digipower-apigateway-api:[unknown-version]: Failure to find com.digipower:digipower:pom:1.0.0 in http://maven.aliyun.com/nexus/content/repositories/central/ was cached in the loca l repository, resolution will not be reattempted until the update interval of alimaven has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ line 5, column 13
分析原因
首先要知道,子POM中标签寻找父POM路径的方式是:
1.relativePath 2.本地仓库 3.远程仓库
因为是新建的maven工程,所以本地和远程仓库没有,所以没有配置relativePath时会抛出找不到父pom的异常。
解决办法
通过relativePath标签指定父pom路径即可。如下
<parent>
<groupId>com.digipower</groupId>
<artifactId>digipower</artifactId>
<version>1.0.0</version>
<relativePath>../../pom.xml</relativePath>
</parent>