Maven使用package打包Spring Boot时出现:Unable to find a single main class from the following candidates的问题解决
问题如下:
[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
Maven使用package打包Spring Boot时出现: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错误的原因是会从所有代码里面扫描包括main方法的类,找到多个类就报 ...
- maven 聚合工程 用spring boot 搭建 spring cloud 微服务 模块式开发项目
项目的简单介绍: 项目采用maven聚合工程 用spring boot 搭建 spring cloud的微服务 模块式开发 项目的截图: 搭建开始: 能上图 我少打字 1.首先搭建maven的聚合工程 ...
- maven 打包 spring boot 生成docker 镜像
1.所使用材料 ,spring boot 项目 基于maven ,maven 工具, docker工具 ps:为啥使用 docker 公司微服务需要启动太多,有两个优点吧! 1.方便管理,2.减少服务 ...
- Maven 之 profile 与Spring boot 的 profile
一.概述 不同的环境(测试环境.开发环境)有不同的配置,目前希望在打包的时候,就直接打出针对不同环境的包(内含有某个环境的配置).Maven本身在 pom.xml 中就提供了 profile 标签进行 ...
- 剑指架构师系列-持续集成之Maven+Nexus+Jenkins+git+Spring boot
1.Nexus与Maven 先说一下这个Maven是什么呢?大家都知道,Java社区发展的非常强大,封装各种功能的Jar包满天飞,那么如何才能方便的引入我们项目,为我所用呢?答案就是Maven,只需要 ...
- Maven项目改为spring boot项目的方法
目录树 新建Maven项目及步骤 修改方法 启动测试 新建Maven项目及步骤 我这里是从创建开始讲,使用的工具是Idea2017版本.如果是已经创建了Maven,想改为spring boot项目的请 ...
- IDEA通过Maven WebApp archetype 创建Spring boot项目骨架
springboot项目资源: GitHub地址:https://github.com/TisFreedom/springbootdome.git 码云地址:https://gitee.com/Tis ...
- Gradle 如何打包 Spring Boot 可执行 JAR
如何在 Gradle 中配置一个项目可以打包为 Spring Boot 可执行 Jar? 你首先需要添加到 org.springframework.boot 到插件中: 例如下面的代码: plugin ...
- BOOT项目依赖另外一个模块的包,开发的时候都正常,执行clean package打包成jar时却提示依赖的模块包不存在。
我在service1模块里依赖了common模块,开发的时候包都能正常引用到,启动也能正常测试访问,可是奇怪的是,当我要打包成jar包时,就提示service1里依赖common的包都不存在,之前从没 ...
随机推荐
- SVM最通俗的解读
摘自:https://www.zhihu.com/question/21094489/answer/86273196 什么是SVM? 当然首先看一下wiki. Support Vector Machi ...
- 【POJ 2442】 Sequence
[题目链接] http://poj.org/problem?id=2442 [算法] 堆 [代码] #include <algorithm> #include <bitset> ...
- bzoj4197 [Noi2015]寿司晚宴——状压DP
题目:https://www.lydsy.com/JudgeOnline/problem.php?id=4197 首先,两个人选的数都互质可以看作是一个人选了一个数,就相当于选了一个质因数集合,另一个 ...
- [Apple开发者帐户帮助]六、配置应用服务(1.2)Apple Pay:在网络上配置Apple Pay
网上Apple Pay允许用户在您的网络应用中购买商品和服务. 首先在您的开发者帐户中创建一个商家标识符,该标识符可以将Apple Pay唯一标识为能够接受付款的商家.您可以为多个本机和Web应用程序 ...
- 浅谈自学Python之路(day1)
2018-02-19 17:15:14 Python语言相对于其他语言较为简洁,也相对好入门比如后面不加分号,基本见不着大括号等优点 第一个程序,也是学每门语言都需要掌握的第一个代码 print(& ...
- swift-自定义TabBar工具栏
class EBTAppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(ap ...
- 基于mybatis向oracle中插入数据的性能对比
数据库表结构: 逐条插入sql语句: <insert id="insert" parameterType="com.Structure"> INSE ...
- WEB笔记-5、字体和文本
字体样式 font-family font-size font-weight font-style font-variant font(简写) 常用字体: serif,衬线字体,每个字符笔画末端会有装 ...
- Hibernate_01_初体验
hibernate开发的基本步骤: 编写配置文档hibernate.cfg.xml: 编写实体类: 生成对应实体类的映射文件并添加到配置文档中: 调用hibernate API进行测试. Hibern ...
- Caffe: gflag编译出现问题汇总
1. 使用Unicode字符集: 出现问题 E:\CodeBase\ML\Caffe\ThirdPartySrc\gflags-master\src\gflags.cc(1340): error C2 ...