1

can you tell me how to skip plugin execution of root pom? This pom contains only defined modules:

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

and this is plugin configuration in bom module (moduleA and moduleB inherits from 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>

When I want execute plugin for all modules which have configured plugin with this command: mvn com.spotify:dockerfile-maven-plugin:build I got error Missing Dockerfile in context directory: /home/denis/workspace/xxxx/root which means that plugin was executed over root pom. I cannot skip it like in bom module, because there is no plugin configuration. Thank you.

Denis Stephanov
  • 4,563
  • 24
  • 78
  • 174
  • Simply wrong only configure the plugin in the module you need it...only define the version in the root via pluginManagement... – khmarbaise Feb 06 '20 at 13:00
  • 1
    @khmarbaise Yes I did it. I have configured plugin in bom where are all my dependencies placed. All children used bom as parent and have only artifact and version. I had same error with bom module but I fixed it with `true`. But now I don't know how to fix it for root. – Denis Stephanov Feb 06 '20 at 13:05
  • @DenisStephanov for more information you can refer this : https://github.com/spotify/dockerfile-maven/issues/87 – Anshul Aug 04 '21 at 07:28

0 Answers0