本地编译打包maven项目时,报spring-boot-maven-plugin 构建找不到的错误。昨天还好好的,本地代码里的pom文件没有做任何改动。
pom.xml中有一段下面的配置:(已去掉项目信息)
org.springframework.boot
spring-boot-maven-plugin 报红
关键错误信息如下:
spring-boot-maven-plugin jar包找不到。
- 去本地仓库,检查是否有该jar包
- 是否是maven配置的setting.xml文件镜像库路径有问题。
- 去远程仓库查看,检查是否有该版本的jar包
通过分析:本地已下载好jar包,只是程序没有刷新找到。
如图点击刷新即可。
或者直接重启idea,再点击。亲测有效。
第二种情况:本地仓库有该jar包,但是setting.xml文件中maven镜像路径问题添加镜像路径:
第三种情况:本地仓库没有该jar包aliyunId central aliyun maven https://maven.aliyun.com/repository/central alimaven central aliyun maven https://maven.aliyun.com/nexus/content/groups/public/ alimaven central aliyun maven https://maven.aliyun.com/nexus/content/repositories/central/ alimaven central aliyun maven https://central.maven.org/maven2 mirrorId central Human Readable Name https://repol.maven.org/maven2/
spring-boot-maven-plugin没有设置version,它会先去远程仓库找最新的版本,然后download到本地,然后完成maven操作等。但是远程仓库里没有相应的jar包,导致执行maven编译出错。因为远程仓库里已经有了最新版本的路径,它就不会使用已经存在的版本。
解决:
给spring-boot-maven-plugin指定具体的version,如下设置:
org.springframework.boot spring-boot-maven-plugin2.4.3



