解決:SpringBoot多模塊項目install到本地maven倉庫時出現Unable to find main class -> [Help 1]


在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>

 

 




免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM