1、背景:

今天给项目打jar包时发现了一个打jar包失败的问题。原因是由于项目的公共包没有main方法导致打包失败,但是我们的公共模块确实不需要main方法,所以需要想办法去掉这项校验,经过查阅资料已解决,特此记录一下

2、错误:

错误内容如下:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.729 s
[INFO] Finished at: 2022-07-09T21:00:11+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.6.4:repackage (repackage) on project yaomall-common:
Execution repackage of goal org.springframework.boot:spring-boot-maven-plugin:2.6.4:repackage failed:
Unable to find main class -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :yaomall-common

3、解决方法在公共模块中的pom文件加入如下配置

方法一:

<plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><configuration><skip>true</skip></configuration></plugin></plugins>

方法二:

<plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><configuration><mainClass>none</mainClass>     <!-- 取消查找本项目下的Main方法:为了解决Unable to find main class的问题 --><classifier>execute</classifier>    <!-- 为了解决依赖模块找不到此模块中的类或属性 --></configuration><executions><execution><goals><goal>repackage</goal></goals></execution></executions></plugin></plugins>

4、解决方案借鉴于如下博主(感谢博主):

https://blog.csdn.net/i402097836/article/details/116232418

项目打包公共模块失败【error:repackage failed: Unable to find main class】相关推荐

  1. springboot项目进行 mvn install 时报错 repackage failed: Unable to find main class 处理记录

    异常描述:springboot项目进行 mvn install时 报错如下 Failed to execute goal org.springframework.boot:spring-boot-ma ...

  2. SpringBoot打包错误(repackage failed: Unable to find main class)

    错误代码 多模块的SpringBoot项目打包失败,错误代码如下. [ERROR] Failed to execute goal org.springframework.boot:spring-boo ...

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

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

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

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

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

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

  6. spring-boot-maven-plugin:2.3.2.RELEASE:repackage failed: Unable to find main class

    问题 公共包执行install时失败,提示: Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.3. ...

  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. 解决spring-boot-maven-plugin:2.2.1.RELEASE:repackage failed: Unable to find main class

    解决:Execution repackage of goal org.springframework.boot:spring-boot-maven-plugin:2.2.1.RELEASE:repac ...

  9. jenkins用spring-boot-maven-plugin构建出错:repackage failed: Unable to find main class

    完整的报错信息如下: [ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.0.4.RE ...

最新文章

  1. 工欲善其事必先利其器,一款开源编码辅助工具~
  2. 5大食物千万别挑太艳的
  3. [转]配置子报表和钻取报表
  4. 以太坊发token教程
  5. ArcGIS几种数据格式2
  6. mysql 中文字段名_10个MySQL的数据库技巧~
  7. 斐波那契数列c++代码_轮到你了,斐波那契数列!
  8. sql server数据库课程设计分析
  9. LeetCode 1754. 构造字典序最大的合并字符串
  10. 測试AtomicInteger与普通int值在多线程下的递增操作
  11. java界面字体大小设置_怎样更改电脑界面的字体大小?
  12. 全面详解c语言使用cJSON解析JSON字符
  13. 数据结构---最小生成树
  14. android fragment 跳到另一个fragment
  15. 软件设计师易错题分析总结
  16. unix和linux发音,Linux术语发音大全
  17. Python 教程视频汇总
  18. 微信小程序 - 数据转excel下载并复制链接
  19. 虚拟机与物理主机设置为同一ip字段
  20. 二十余款Linksys路由器曝出安全漏洞,或可被远程控制

热门文章

  1. java家用电器远程管理系统
  2. 日语助词小结,日语助词特殊用法总结
  3. 小米10至尊纪念版是5G手机吗 小米10至尊纪念版参数配置
  4. 管易云对接打通金蝶云星空仓库查询接口与仓库新增接口
  5. HTML5~表单form总结
  6. 小蒜蒜学习了与圆相关的知识,那么当然要学以致用啦。
  7. [数据可视化] 词云(Word Cloud)
  8. 磨金石教育丨插画如何构图?这9个思路百用不厌
  9. Multiple packages found with the same name “can_msgs”问题解决
  10. adc转换时钟_24小时时钟转换器:如何将AM / PM转换为24小时时间