解决: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