Spring boot 启动主方法报错 【run failed: Unable to find a single main class from the following candidates】

以下是报错文本:

D:\DEV\Java\jdk1.8.0_20\bin\java.exe -Dmaven.multiModuleProjectDirectory=F:\repository\CS-MING\module\module-cs -Dmaven.home=F:\maven\apache-maven-3.3.9 -Dclassworlds.conf=F:\maven\apache-maven-3.3.9\bin\m2.conf "-javaagent:D:\Program Files\JetBrains\IntelliJ IDEA 2018.1.5\lib\idea_rt.jar=62886:D:\Program Files\JetBrains\IntelliJ IDEA 2018.1.5\bin" -Dfile.encoding=UTF-8 -classpath F:\maven\apache-maven-3.3.9\boot\plexus-classworlds-2.5.2.jar org.codehaus.classworlds.Launcher -Didea.version=2018.1.5 -s F:\maven\apache-maven-3.3.9\conf\settings.xml -Dmaven.repo.local=F:\maven\repository org.springframework.boot:spring-boot-maven-plugin:2.0.3.RELEASE:run -f pom.xml
[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for com.joyce:module-cs:jar:1.0.0
[WARNING] 'build.plugins.plugin.version' for org.springframework.boot:spring-boot-maven-plugin is missing. @ com.joyce:module-cs:[unknown-version], F:\repository\CS-MING\module\module-cs\pom.xml, line 428, column 12
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building module-cs 1.0.0
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> spring-boot-maven-plugin:2.0.3.RELEASE:run (default-cli) > test-compile @ module-cs >>>
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ module-cs ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 83 resources
[INFO] Copying 4 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.5:compile (default-compile) @ module-cs ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ module-cs ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory F:\repository\CS-MING\module\module-cs\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.5:testCompile (default-testCompile) @ module-cs ---
[INFO] No sources to compile
[INFO] 
[INFO] <<< spring-boot-maven-plugin:2.0.3.RELEASE:run (default-cli) < test-compile @ module-cs <<<
[INFO] 
[INFO] --- spring-boot-maven-plugin:2.0.3.RELEASE:run (default-cli) @ module-cs ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.656 s
[INFO] Finished at: 2018-12-17T15:20:17+08:00
[INFO] Final Memory: 18M/307M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.0.3.RELEASE:run (default-cli) on project module-cs: Execution default-cli of goal org.springframework.boot:spring-boot-maven-plugin:2.0.3.RELEASE:run failed: Unable to find a single main class from the following candidates [com.joyce.cs.CsApplication, com.joyce.cs.service.impl.WeiXinPayServiceImpl, com.joyce.cs.service.impl.CsWeiXinUtilServiceImpl] -> [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

Process finished with exit code 1

 

异常分析;

找到多个main方法;看报错提示;

解决办法:

删除 CsWeiXinUtilServiceImpl 和 WeiXinPayServiceImpl 类中的 main方法。启动成功

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小镇IT探险家

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值