美文网首页
Execution repackage of goal org.

Execution repackage of goal org.

作者: 大华夏 | 来源:发表于2021-06-18 00:30 被阅读0次

springboot项目有多个模块,在项目编译时报如下错误:

[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.2.1.RELEASE:repackage (repackage) on project xxx: Execution repackage of goal org.springframework.boot:spring-boot-maven-plugin:2.2.1.RELEASE:repackage failed: Unable to find a single main class from the following candidates [xxx.xxxx.Class] -> [Help 1]
[ERROR] 

原因是项目的根pom.xml中配置了build:

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <!-- 指定resources插件处理哪个目录下的资源文件 -->
                <directory>src/main/resources</directory>
                <!-- 打开资源过滤功能 -->
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>

而项目中,不是所有的模块都是可以打包成可运行的JAR包,故引发了报错。
解决方案是,在编译报错的模块pom.xml中配置build:

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
        </plugins>
    </build>

再次编译则可顺利完成编译。

相关文章

网友评论

      本文标题:Execution repackage of goal org.

      本文链接:https://www.haomeiwen.com/subject/scvhyltx.html