您的位置:首页 > 编程语言 > Java开发

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