解决:Execution repackage of goal org.springframework.boot:spring-boot-maven-plugin:2.2.1.RELEASE:repackage failed: Unable to find main class

这个大坑整了我一晚上,现在解决了做个总结:
首先我们看报错原因,为什么会说不能找到主类?其次我们定位一下我们项目中配了spring-boot-maven-plugin:2.2.1.RELEASE的位置。

 <build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin></plugins><resources><resource><directory>src/main/java</directory><includes><include>**/*.xml</include></includes><filtering>false</filtering></resource></resources></build>

1.首先理解这段代码的作用:spring-boot-maven-plugin插件是将springboot的应用程序打包成fat jar的插件。spring boot 借助spring-boot-maven-plugin将所有应用启动运行所需要的jar都包含进来,从逻辑上将具备了独立运行的条件。
2.spring-boot-maven-plugin打包条件:会去扫描项目的main方法,也就是说,引入改配置,你就需要在src/java/mian下写一个启动类。

好,知道了前提引入我的开发环境。

如图,父子项目中,只有service下的两个项目为可执行jar包,其他的都不可执行。错就错在在主类添加了spring-boot-maven-plugin插件,导致install项目时,去扫描了model、common等不可执行的文件。

解决:将父类中的spring-boot-maven-plugin插件注释掉,并确保子项目不可执行项目中没有spring-boot-maven-plugin插件配置。

(resource内的内容为将配置文件一块打包)

至此,我们reload后再clean、install试试。

成功!

多嘴说一句:开发搭环境的时候不要盲目的配置插件,要了解该插件是否满足自己的开发需求。

贴上一篇给我启发的文章链接:
https://blog.csdn.net/qq_41264674/article/details/106539584

以上仅满足解决个人的开发问题,大家仅作参考,若有说的不正确的地方欢迎指出。谢谢!继续去刚代码了。

解决spring-boot-maven-plugin:2.2.1.RELEASE:repackage failed: Unable to find main class相关推荐

  1. maven testNG打成jar包运行报错repackage failed: Unable to find main class

    一.maven testNG如何打jar包 1.pom文件引入插件 <build><plugins><plugin><groupId>org.apach ...

  2. org.springframework.boot:spring boot maven plugin丢失---SpringCloud Alibaba_若依微服务框架改造_--工作笔记012

    警告]"build.plugins.plugin.version"for org.springframework.boot:spring boot maven plugin丢失. ...

  3. Spring Boot的Maven插件Spring Boot Maven plugin详解

    pring Boot的Maven插件(Spring Boot Maven plugin)能够以Maven的方式为应用提供Spring Boot的支持,即为Spring Boot应用提供了执行Maven ...

  4. maven打包插件----Spring Boot Maven Plugin

    官方文档链接地址:http://docs.spring.io/spring-boot/docs/1.3.0.BUILD-SNAPSHOT/maven-plugin/index.html 第一部分 Sp ...

  5. Idea Spring Boot项目提示 repackage failed: Unable to find main class

    本人项目是一个多模块的Spring Boot项目,模块打包时一直显示没有找到主类,很奇怪,我项目中其它的模块都可以正常打包 报错内容: Failed to execute goal org.sprin ...

  6. maven打包repackage failed: Unable to find main class

    一.Maven打包Spring Boot项目报错(repackage failed: Unable to find main class),排除寻找Main方法,一般用于被依赖的公用常量模块,解决方法 ...

  7. maven package异常repackage failed: Unable to find main class

    现象 模块package时出现异常 Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.5.1:rep ...

  8. Maven打包问题:repackage failed: Unable to rename解决

    今天在给spring boot项目打jar包的时候遇到了一个问题: Failed to execute goal org.springframework.boot:spring-boot-maven- ...

  9. spring boot maven项目返回值乱码的解决方法

    spring boot maven项目返回值乱码的解决方法 1.先看乱码效果: spring boot maven项目,返回值乱码,如下图: 控制台打印log乱码,如下图: 有swagger的话,sw ...

最新文章

  1. 什么是采样层(pooling)
  2. graphs菜单_图形用户界面菜单全面解析
  3. 辽宁学业水平测试 计算机考试,辽宁高中学业水平考试报名系统
  4. python为什么运行不了_python为什么会环境变量设置不成功
  5. 操作系统之文件管理:1、初识文件管理
  6. 【Linux】Linux查看机器负载-IO负载
  7. 获取Access数据库中的用户表名
  8. nginx的源码编译及相关文件配置
  9. python 控制流
  10. html中创建电子邮件链接
  11. 教育行业下半场强势到来!专访FCG教育链Edward Cai:从互联网教学到“链教学”,让天下没有不公平的教育...
  12. SAP采购中基于收货的发票校验应用逻辑及控制
  13. UOS Deepin 安装 flatpak
  14. 阿龙的学习笔记---3.26---常用的各种树
  15. 这届“怕死”的年轻人,“疫后”正在拼命“养生”
  16. 系统架构设计-安全篇
  17. 1140 单位矩阵初始化
  18. css实现网页轮播图设置
  19. 关于数字证书数字签名以及CA的关系梳理
  20. 百度翻译API的简单调用

热门文章

  1. 关于VC2010工程中的ipch文件夹和sdf文件
  2. 淘淘商城--企业面试题整理
  3. A40i T3开发板外扩接口的功能测试
  4. IMS (IP多媒体子系统)
  5. 尔雅科学计算与matlab,科学计算与MATLAB语言尔雅2020年章节答案
  6. 蓝桥杯之单片机设计与开发(20)——DS1302
  7. 汇编语言 第3版 王爽 检测点答案及详细解析
  8. SpringMVC高级篇
  9. Openjudge NOI题库1.11编程基础之二分查找04 网线管理
  10. JAVA萌新学习day16