SpringBoot项目本地运行正常,Maven打包报错:spring-boot-maven-plugin
SpringBoot项目本地运行正常,Maven打包报错:Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.5.9.RELEASE:repackage failed原因是添加该插件后编译打包时会自动寻找项目中的启动类,如果某个模块没有启动类或者有多个main启动类就会报错,通过保证模块启动类m
·
问题描述
SpringBoot项目本地运行正常,Maven打包报错:Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.5.9.RELEASE:repackage failed
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.5.9.RELEASE:repackage (default) on project SpringCloudUserFeign: Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.5.9.RELEASE:repackage failed: Unable to find main class -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
ERROR http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
Process finished with exit code 1
原因分析:
原因是添加该插件后编译打包时会自动寻找项目中的启动类,如果某个模块没有启动类或者有多个main启动类就会报错,通过保证模块启动类main启动类入口唯一也可以解决。
解决方案:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<!-- spring boot启动类的路径 -->
<mainClass>com.test.ApplicationMain</executable>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐

所有评论(0)