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


猜你喜欢

转载自www.cnblogs.com/wangxiaoqian/p/12404808.html