错误提示如下

错误内容
Some problems were encountered while building the effective model for org.springframework.boot:test01:jar:2.4.0
'parent.relativePath' of POM org.springframework.boot:test01:2.4.0 (E:\JavaWeb_base\springbootTest\test01\pom.xml) points at com.ltb:springbootTest instead of org.springframework.boot:spring-boot-starter-parent, please verify your project structure @ line 7, column 13
It is highly recommended to fix these problems because they threaten the stability of your build.
For this reason, future Maven versions might no longer support building such malformed projects.
错误分析
子模块的parent写的不是父模块,而是继承了springboot
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.0</version>
</parent>
解决方法
在该<parent>标签中加上<relativePath />
即
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.0</version>
<relativePath />
</parent>
此时,再次运行该生命周期方法,没有警告提示


本文解决了Spring Boot项目中子模块POM文件配置错误导致的问题。主要原因是子模块的parent属性指向不正确,通过添加<relativePath/>标签解决了这一问题。

396

被折叠的 条评论
为什么被折叠?



