一个常见的Maven问题:父子工程Maven打包报错:Unable to find a single main class from the following candidates
Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.2.1.RELEASE:repackage (repackage) on project live_B: Execution repackage of goal org.springframework.boot:spring-boot-maven-plugin:2.2.1.RELEASE:repackage failed: Unable to find a single main class from the following candidates [xxx]

Unable to find a single main class from the following candidates


分析:
因为 工程A打包需要去本地仓库找 工程B.jar包,但事先我没有将 工程B.jar 放到本地仓库中,导致才会报出这个错误。

解决:
方式一、在工程B.jar的pom中,执行maven install

方式二、其实还有更简单的方法:直接在父项目中执行maven install,发现父项目下的子项目全部打包成功。

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐