报错:
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.4.0.RELEASE:repackage (default) on project hy-udf-platform: Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.4.0.RELEASE:repackage failed: Unable to find a single main class from the following candidates [com.ihyht.app.qygxtp.UdfApplication, com.ihyht.app.qygxtp.udf.PYUDF, com.ihyht.app.qygxtp.utils.PingYinUtil] -> [Help 1]
原因:
这个错误是因为Maven在执行打包的时候会查找项目中的main方法,并设置为Spring Boot生成JAR包的启动入口,但此时有多个main方法,Maven插件就无法确认是用哪个。因此出现此异常。
解决:
方式1. 注释掉其他测试用的main方法即可解决此问题。
方式2. 打包时添加如下命令:指定main方法
clean package -Dstart-class=com.ihyht.app.qygxtp.UdfApplication