异常描述:springboot项目进行 mvn install时 报错如下

Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.2.7.RELEASE:repackage (repackage) on project match-service: Execution repackage of goal org.springframework.boot:spring-boot-maven-plugin:2.2.7.RELEASE:repackage failed: Unable to find main class

排查报错原因:
在各模块的pom.xml中均引入了maven 打包插件

    <build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin></plugins></build>

在插件运行时
需要指定或者继承了spring-boot-starter-parent并且配置需属性,然后插件会自动寻找签名是public static void main(String[] args)的方法… ,
mainClass和statrt-class即程序的入口,即使用了@SpringBootApplication注解且有main方法的启动类,
我这里的原因是,由于没有添加启动类。所以执行mvn install时会报上述异常

解决办法:
添加启动类或者注释掉没有启动类的模块pom中的上述依赖。

附加知识点:
下配置mainClass,指定程序入口。

<plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><version>1.5.3.RELEASE</version><configuration><mainClass>com.xx.webapps.api.main.WebappsApiBidMain</mainClass></configuration><executions><execution><goals><goal>repackage</goal></goals></execution></executions>
</plugin>

Spring Boot Maven Plugin提供了几个目标(goal),我们在标签里配置的repackage对应spring-boot:repackage这个目标。

如果你的pom继承自spring-boot-starter-parent(注意此前提),也可以直接在配置(其实这里的start-class直接对应清单文件里的Start-Class):

<properties><start-class>com.xx.webapps.api.main.WebappsApiBidMain</start-class>
</properties>

springboot项目进行 mvn install 时报错 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. SpringBoot打包错误(repackage failed: Unable to find main class)

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

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

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

  4. 项目打包公共模块失败【error:repackage failed: Unable to find main class】

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

  5. 解决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 ...

  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. 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 ...

  9. 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. ...

最新文章

  1. SAP MM 初阶之事务代码MIGO中采购退货的处理
  2. oracle 当前年到指定年的年度范围求取
  3. 使用admodify工具修改用户主目录时的注意事项
  4. 设置在本文件里查找_Win 10 自带聚焦搜索?这么设置轻松查找电脑文件
  5. highcharts总结
  6. c语言程序后退_c语言中向后退一格是啥符号?
  7. [Android]使用ViewPager实现图片滑动展示
  8. python-kafka多线程快速读取consumer消费者数据,同时使用批读取与无限流读取改进
  9. B站发布2020年一季度财报:月活用户达1.72亿,日活用户突破5000万
  10. 定时器name冲突会报错吗_在西门子STEP7编程中常用的S5定时器的那些你要知道的事情...
  11. 视频ToneMapping(HDR转SDR)中的颜色空间转换问题(BT2020转BT709,YCbCr、YUV和RGB)
  12. BAT文件里注释符号
  13. 用LabVIEW开发简仪USB101数据采集卡会是怎样的?
  14. Zhu-Net——一个隐写分析网络
  15. 关爱女性健康的移动产品竞品分析报告
  16. 404常见的几种错误原因
  17. JS验证邮箱合理性(初级版)
  18. Go Http 解析 text/plain
  19. 在LiCO中实现模型训练
  20. 布斯乘法算法的流程图

热门文章

  1. 解读 Flaky Test
  2. 【AI】简单的方法教你做一组字体设计
  3. 如何做一个完全失败的UX设计师?
  4. win7 怎么干净删除php,怎么把一个软件卸载干净
  5. Fiddler基础教程 - 3. 抓包 | 设置断点 | 捕获设置 | 重定向AutoResponder | 过滤Filters
  6. 为爱心助力!替换网站的404为宝贝回家把404页面利用起来!
  7. Vue -- 初始化安装时出现run `npm audit fix` to fix them, or `npm audit` for details
  8. TypeError: _vm.__HOLDER__ is not a function
  9. 杰华特科创板上市吗?杰华特IPO不远矣!
  10. 上课偷懒全靠它,VS code中搭建Java开发环境+小霸王游戏环境—颤抖吧,德玛西亚!!