以下是报错文本:
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方法。启动成功
博客展示了Java项目启动时的报错文本,提示无法从多个候选类中找到单个主类。经分析是存在多个main方法导致,解决办法是删除CsWeiXinUtilServiceImpl和WeiXinPayServiceImpl类中的main方法,之后项目启动成功。
5618

被折叠的 条评论
为什么被折叠?



