【日常Exception】第三十一回:repackage failed: Unable to find a single main class from the following candidate
1、问题
今天使用Jenkins构建部署服务时,报了如下错误:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.331s
[INFO] Finished at: Thu Aug 11 11:34:00 CST 2022
[INFO] Final Memory: 78M/1031M
[INFO] ------------------------------------------------------------------------
[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]
[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
Build step 'Execute shell' marked build as failure
Finished: FAILURE
关键错误提示,其实是:
org.springframework.boot
2.2.5.RELEASE:repackage failed: Unable to find a single main class from the following candidates
2、解决方式
原因:项目类,我写了一个测试的main方法,导致Jenkins构建时,不知道使用哪个main方法。因为springboot项目,本身也是有一个main方法的。
解决:把自己写的main方法注释掉,或直接删除掉,就可以啦!
还没有评论,来说两句吧...