本人项目是一个多模块的Spring Boot项目,模块打包时一直显示没有找到主类,很奇怪,我项目中其它的模块都可以正常打包
报错内容:
Failed to execute goal org.springframework.boot: spring-boot-maven-plugin:2.6.4: repackage (repackage) on project XXX: Execution repackage of goal org.springframework.boot: spring-boot-maven-plugin:2.6.4: repackage failed: Unable to find main class
解决方法:
在项目该模块中,新建立一个包含主函数的类,然后在 Maven 中重新 install 打包该模块就成功了。事后可以删除,目前没发现什么问题。