Maven报错总结
Maven报错总结
cmyang1. Maven使用过程中的报错总结
maven刷新报错’parent.relativePath’ of POM
1
'parent.relativePath' of POM com.xxx.web.cloud:xxx-boot-job:1.1.1-SNAPSHOT (D:\code\xxx-build\xxx-boot-job\pom.xml) points at com.xxx:xxx-build instead of com.xxx.web.cloud:xxx-parent, please verify your project structure
原因:parent中指定的父级和modules指定的pom,不是同一个项目
父级指定的
1
2
3
4
5
6
7<parent>
<artifactId>xxx-parent</artifactId>
<groupId>com.xxx.web.cloud</groupId>
<version>1.1.1-SNAPSHOT</version>
</parent>
<artifactId>xxx-boot-job</artifactId>
<packaging>pom</packaging>modules中指定的
1
2
3
4
5
6
7<groupId>com.xxx</groupId>
<artifactId>xxx-build</artifactId>
<version>1.1.1-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>xxx-boot-job</module>
</modules>
解决:在parent中添加
<relativePath/>
,作用:查找依赖父项目的顺序为: relativePath配置的地址 -> 本地仓库 -> 远程仓库,默认值为../pom.xml
1
2
3
4
5
6<parent>
<artifactId>xxx-parent</artifactId>
<groupId>com.xxx.web.cloud</groupId>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../xxx-parent</relativePath>
</parent>
构建报错’parent relativePath’ points at no local POM @ line 5, column 13
1
[FATAL] Non-resolvable parent POM for com.xxx.web.cloud:xxx-boot-starter-ribbon:1.1.1-SNAPSHOT: Failure to find com.xxx.web.cloud:xxx-boot-starters:pom:1.1.1-SNAPSHOT in http://xxx.xxx.xxx.xxx:xxxx/repository/maven-public/ was cached in the local repository, resolution will not be reattempted until the update interval of nexus-public has elapsed or updates are forced and 'parent.relativePath' points at no local POM @ line 5, column 13
原因:parent中错误的添加了
<relativePath/>
,导致构建找不到pom文件1
2
3
4
5
6<parent>
<groupId>com.xxx.web.cloud</groupId>
<artifactId>xxx-boot-starters</artifactId>
<version>1.1.1-SNAPSHOT</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>解决:当parent和modules配置一致时,无需指定relativePath,直接删除即可
1
2
3
4
5<parent>
<groupId>com.xxx.web.cloud</groupId>
<artifactId>xxx-boot-starters</artifactId>
<version>1.1.1-SNAPSHOT</version>
</parent>