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

Posted 善良勤劳勇敢而又聪明的老杨

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了日常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:spring-boot-maven-plugin:2.2.5.RELEASE:repackage failed: Unable to find a single main class from the following candidates 


 2、解决方式

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

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

以上是关于日常Exception第三十一回:repackage failed: Unable to find a single main class from the following candidate的主要内容,如果未能解决你的问题,请参考以下文章

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

一起Talk Android吧(第三百三十一回: HTTP协议概述)

日常Exception第二十一回:IDEA Maven构建配置文件失效,target中未正确出现对应环境的配置文件

日常Exception第三十回:Flink异常NoResourceAvailableException: Could not acquire the minimum required resour

日常Exception第三十回:Flink异常NoResourceAvailableException: Could not acquire the minimum required resour

日常Exception第三十回:Flink异常NoResourceAvailableException: Could not acquire the minimum required resour