Spring Boot 项目中只能有一个main方法
2017-11-07 00:00
453 查看
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.3.5.RELEASE:repackage (default) on project mac_filing: 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.coocaa.rifle.mf.Application, com.coocaa.rifle.mf.interceptor.test] -> [Help 1]
由上可知是两个main方法冲突了,把com.coocaa.rifle.mf.interceptor.test中的main方法删除后,就可以打包了。
原来是因为 Spring Boot 项目中只能有一个main方法,不然 spring-boot-maven-plugin 在打包的过程中会扫描到了多个 main 方法,然后就懵逼不知道用哪个作为启动方法了。
以前总喜欢在 Utils 中写个main方法来调试静态方法,看来以后用完就得随手把它给删除了。
相关文章推荐
- 一个Springboot 热部署的方法(基于gradle构建的项目) 3ff8
- 【demo】新建一个springboot项目最简单的方法
- 我的第三个springboot项目,servlet实现一个转盘抽奖程序
- spring-boot轻松搭建一个项目框架(代码)
- IDEA上面搭建一个SpringBoot的web-mvc项目
- spring-boot项目的创建以及部署到外部tomcat的方法
- IDEA上面搭建一个SpringBoot的web-mvc项目
- 创建一个SpringBoot + springmvc + hibernateJPA + MyBatis的项目
- 搭建一个spring-boot项目 3
- IDEA上面搭建一个SpringBoot的web-mvc项目遇到的问题
- (3)Spring-boot学习 做一个简单的带访问数据库的web项目
- 新建一个maven spring boot项目中遇到的问题
- .NET入门(四)一个项目,只能有一个类有Main,否则出现"定义了不止一个入口点"的异常
- 搭建一个spring-boot项目 4
- IDEA中启动一个springboot项目(2)
- Java项目中每一个类都可以有一个main方法
- SpringBoot项目打包后,找不到文件路径问题,处理方法
- 搭建一个spring-boot项目 1
- STS 新建一个spring-boot rest 项目
- 搭建一个spring-boot项目 2