自定义spring-boot-autocofigure使用maven打包的时候报错了:Failed to execute goal org.springframework.boot:spring-boot-maven-plugin

报错信息如下:

Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.4.5:repackage (repackage) on project andy-hello-world-spring-boot-starter-autoconfiguration: Execution repackage of goal org.springframework.boot:spring-boot-maven-plugin:2.4.5:repackage failed: Unable to find main class

 

原来是我使用spring-initializr创建spring-boot项目的时候,pom.xml中会自动引入spring-boot-maven-plugin插件,这个插件会检查项目中是否有@SpringbootApplication注解修饰的main方法。

删除pom.xml中的如下插件即可

 

 

另外推荐下尚硅谷的spring-boot自定义starter的视频资料。

https://www.bilibili.com/video/BV19K4y1L7MT?p=83

 

posted on 2021-05-15 11:43  坚守梦想  阅读(790)  评论(0编辑  收藏  举报