[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:3.2.1:repackage (repackage) on project defect-mgmt-api-define: Execution repackage of goal org.springframework.boot:spring-boot-maven-plugin:3.2.1:repackage failed: Unable to find main class -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:3.2.1:repackage (repackage) on project defect-mgmt-api-define: Execution repackage of goal org.springframework.boot:spring-boot-maven-plugin:3.2.1:repackage failed: Unable to find main class
该jar包是一个根据openapi定义文件自动生成接口文件的包,添加了spring boot的依赖。在打包时,spring 的maven插件对该包进行了重新打包。该插件需要打一个可执行jar包,所有会去找main class,但是实际只需要一个库jar包,不需要执行,就没有配置spring的main class,所有就报了上面的错。解决方式是,禁用spring maven插件的重新打包。
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>