1

你能告诉我如何跳过root pom的插件执行吗?这个 pom 只包含定义的模块:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <packaging>pom</packaging>
    <groupId>com.company</groupId>
    <artifactId>root</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>root</name>

    <modules>
        <module>bom-module</module>
        <module>moduleA</module>
        <module>moduleB</module>
    </modules>
</project>

这是bom模块中的插件配置(moduleA和moduleB继承自bom):

            <plugin>
                <groupId>com.spotify</groupId>
                <artifactId>dockerfile-maven-plugin</artifactId>
                <version>${dockerfile-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <id>docker</id>
                        <goals>
                            <goal>build</goal>
                            <goal>push</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <repository>xxxxxx</repository>
                    <tag>${project.version}</tag>
                    <buildArgs>
                        <JAR_FILE>target/${project.build.finalName}.jar</JAR_FILE>
                    </buildArgs>
                    <skip>true</skip>
                </configuration>
            </plugin>

当我想为所有使用此命令配置插件的模块执行插件时:mvn com.spotify:dockerfile-maven-plugin:build我收到错误Missing Dockerfile in context directory: /home/denis/workspace/xxxx/root,这意味着插件是通过根 pom 执行的。我不能像在 bom 模块中那样跳过它,因为没有插件配置。谢谢你。

4

0 回答 0