错误:No plugin found for prefix spring-boot in the current project and in the plugin groups

商同
2023-12-01

前言

  • maven 3.6.1
  • springboot v2.1.x

在多模块的 Maven 项目中,执行 mvn spring-boot:run -pl xxx.groupId:xxx.artifactId命令启动某个 Module 。

错误:No plugin found for prefix spring-boot in the current project and in the plugin groups

在多模块的 Maven 项目中,使用 spring-boot:run 执行启动时,遇到错误:No plugin found for prefix spring-boot in the current project and in the plugin groups

鼓捣了半天,好了。

发生该错误应该是项目的当前配置中缺少spring-boot-maven-plugin插件所致。
分2种情况处理:

  • 项目的父项目是 spring-boot-starter-parent,这种情况下应该不会出这个错误的。如果过出现了,可以检查是否有拼写错误
  • 项目的父项目不是 spring-boot-starter-parent,但某一级父级项目的父项目是 spring-boot-starter-parent,同上。
  • 项目的父项目不是 spring-boot-starter-parent,也不存在某一级父级项目的父项目是 spring-boot-starter-parent,那检查是否未包含spring-boot-maven-plugin插件(本项目未包含时,手动添加)。

再次验证真理:只要设置对,就不会出错。
解决办法:出现这个错误时,将设置修改对即可。对的设置,参考这里

参考

No plugin found for prefix spring-boot in the current project and in the plugin groups异常解决
maven 多模块项目关系
【sprinb-boot】maven 多模块项目:单独 spring-boot:run 某个模块

 类似资料: