Maven使用package打包Spring Boot时出现:Unable to find a single main class from the following candidates的问题解决
2017-08-25 10:44
2096 查看
问题如下:
解决方法:
这个错误是因为Maven在执行打包的时候会查找项目中的main方法,并设置为Spring Boot生成JAR包的启动入口,但此时有多个main方法,Maven插件就无法确认是用哪个。因此出现此异常。
1、注释掉其他无用的main方法即可解决此问题。
2、在命令上指定入口:
参考:
http://www.cnblogs.com/xingzc/p/5972488.html
http://blog.csdn.net/yuechang5/article/details/52489911
https://segmentfault.com/a/1190000007462351
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.3.5.RELEASE:repackage (default) on project information: Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.3.5.RELEASE:repackage failed: Unable to find a single main class from the following candidates [com.hhly.InformationApplication, com.hhly.test.Application] -> [Help 1]
解决方法:
这个错误是因为Maven在执行打包的时候会查找项目中的main方法,并设置为Spring Boot生成JAR包的启动入口,但此时有多个main方法,Maven插件就无法确认是用哪个。因此出现此异常。
1、注释掉其他无用的main方法即可解决此问题。
2、在命令上指定入口:
mvn package -Dstart-class=com.jsoft.MainClass
参考:
http://www.cnblogs.com/xingzc/p/5972488.html
http://blog.csdn.net/yuechang5/article/details/52489911
https://segmentfault.com/a/1190000007462351
相关文章推荐
- Springboot repackage failed: Unable to find a single main class from the following candidates
- SpringBoot学习之一 Unable to find a single main class from the following candidates
- Unable to find a single main class from the following candidates
- Unable to find a single main class from the following candidates
- Unable to find a single main class from the following candidates
- spring boot打包时Unable to find a single main class的解决方法
- Caused by: java.lang.IllegalStateException: Unable to find a single main class from问题解决
- spring boot maven Unable to find main class
- unable to find javac compiler;com.sun.tools.javac.Mainisnotontheclasspath的问题的解决
- Java问题解决:springboot启动出现-Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package
- Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.5.6.RELEASE:repackage failed: Unable to find main class
- 解决com.sun.tools.javac.Main is not on the classpath / Unable to find a javac compiler 的问题
- make menuconfig 出现 Unable to find the Ncurses libraries 问题解决
- 解决使用Genymotion出现Unable to start the virtual device.VirtualBox cannot start the virtual device.问题
- Spring Boot应用的Unable to find main class异常详解
- Maven编译报错[ERROR] Fatal Error: Unable to find package java.lang in classpath or bootclasspath
- Eclipse下编译出现错误:can not find the main class,Program will exit 问题解决
- maven项目,多个依赖,打成一个可执行jar包,可根据profiles进行打包,出现的Could not find or load main class的解决方法。
- 使用PHP中的库函数file_get_contents时出现Unable to find the wrapper "https"错误解决