[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>
SpringBootMavenPluginRepackageError:MissingMainClassforLibraryJar
文章讲述了在使用SpringBootMaven插件对一个根据OpenAPI定义生成接口的库项目进行打包时遇到的问题,因为该项目不需要可执行jar,导致找不到mainclass。解决方法是通过配置`<skip>true</skip>`来禁用插件的重新打包功能。
2085

被折叠的 条评论
为什么被折叠?



