【日常Exception】第三十一回:repackage failed: Unable to find a single main class from the following candidate

深藏阁楼爱情的钟 2024-04-08 09:33 171阅读 0赞

1、问题

今天使用Jenkins构建部署服务时,报了如下错误:

  1. [INFO] ------------------------------------------------------------------------
  2. [INFO] BUILD FAILURE
  3. [INFO] ------------------------------------------------------------------------
  4. [INFO] Total time: 7.331s
  5. [INFO] Finished at: Thu Aug 11 11:34:00 CST 2022
  6. [INFO] Final Memory: 78M/1031M
  7. [INFO] ------------------------------------------------------------------------
  8. [ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.2.5.RELEASE:repackage (default) on project fargo-file-server: Execution default of goal org.springframework.boot:spring-boot-maven-plugin:2.2.5.RELEASE:repackage failed: Unable to find a single main class from the following candidates [hk.com.***.***.FileServerApplication, hk.com.***.***helper.***ClientHelper] -> [Help 1]
  9. [ERROR]
  10. [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
  11. [ERROR] Re-run Maven using the -X switch to enable full debug logging.
  12. [ERROR]
  13. [ERROR] For more information about the errors and possible solutions, please read the following articles:
  14. [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
  15. Build step 'Execute shell' marked build as failure
  16. Finished: FAILURE

关键错误提示,其实是:

org.springframework.boot:spring-boot-maven-plugin:2.2.5.RELEASE:repackage failed: Unable to find a single main class from the following candidates

7d0e5d321c4a41cfb1d1e9e67c17b287.png


2、解决方式

原因:项目类,我写了一个测试的main方法,导致Jenkins构建时,不知道使用哪个main方法。因为springboot项目,本身也是有一个main方法的。

解决:把自己写的main方法注释掉,或直接删除掉,就可以啦!

发表评论

表情:
评论列表 (有 0 条评论,171人围观)

还没有评论,来说两句吧...

相关阅读