在springboot打包一個api模塊發布到本地倉庫的過程中,出現打包錯誤
Execution repackage of goal org.springframework.boot:spring-boot-maven-plugin:2.1.6.RELEASE:repackage failed: Unable to find main class -> [Help 1]
該錯誤的原因是api模塊的父模塊中包含了這個build插件,所有api模塊也繼承了這個插件,由於這個插件是針對XXXspringbootApplication.class這個入口類的,當api模塊中沒有這個入口類時就會出現Unable to find main class錯誤。
解決方案:刪除父模塊pom文件中的下述代碼即可。
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build>