解决: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. 清华大学开源迁移学习算法库:基于PyTorch实现,支持轻松调用已有算法
  2. mysql 允许远程登录
  3. linux 打包压缩工具
  4. 问题小结(一)——servlet生命周期、get和post请求、内置对象、单例模式等
  5. FreeRTOS 之 在Cortex-M中应用时的中断优先级设置
  6. Redis Cluster 集群模式原理和动态扩容
  7. 《C++ Primer 第五版》(第1~6章总结)
  8. MSP432P401R TI Drivers 库函数学习笔记(三)认识任务的创建及图形化配置
  9. python手册中文版-python学习手册下载|
  10. ML-Agents案例之跳墙游戏
  11. (图文详细)设置文件夹中的文件显示文件后缀名的方法
  12. ubuntuv20启动界面美化_聊一聊我的win10系统美化/使用习惯
  13. 守护游戏安全,保障开发权益丨客户案例
  14. 一文简单理解反向代理和正向代理模型
  15. mysql占用内存过高_mysql数据库占用内存过高解决办法
  16. 美国国家学术出版社所有PDF图书开放免费下载
  17. 面试被问到如何设计微信钉钉后端高并发IM架构?懵了.....
  18. PHP商城的搜索功能
  19. Vue脚手架使用步骤
  20. 关于微信小程序的坑uploadFile:fail Error: unable to verify the first certificate

热门文章

  1. (if-else语法)找零的计算
  2. 使用Java生成二维码
  3. 根据姓名查询工资java_excel实用技巧之根据姓名或者工号查询工资
  4. 小组项目第四、五周:后端数据——模拟炒股系统(2)
  5. 自己搭建一套自动焊接机器人
  6. 三字经带注解_《三字经》完整注释版
  7. 人生最大的敌人就是自己
  8. html 实现二维效果图,25个很酷CSS3效果欣赏
  9. 简单句——5种基本句型
  10. YELP NLP 文本信息提取项目