300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > maven打包报错failed: Unable to find a single main class from the following candidates []

maven打包报错failed: Unable to find a single main class from the following candidates []

时间:2021-10-23 23:01:14

相关推荐

maven打包报错failed: Unable to find a single main class from the following candidates []

报错

maven打包报错failed: Unable to find a single main class from the following candidates [com.zjq.xxxApplication,com.zjq.xxxUtil]

报错意思是:无法从多个类中找到唯一一个启动类。

解决办法

如果当前工程为启动工程,可以在pom文件的打包插件中按照如下配置指定启动的application路径,具体如下:

<plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><configuration><mainClass>com.zjq.xxxApplication</mainClass></configuration></plugin></plugins>

要是父子工程中,子工程比如common工程只作为依赖包,没有作为springboot的application启动时,以下打包插件不配置到顶级pom及common的pom中

<plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin>

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。