spotify / docker-maven-plugin

INACTIVE: A maven plugin for Docker
Apache License 2.0
2.67k stars 575 forks source link

I can't use the plugin exclusively on a child module #263

Closed jacklaplante closed 8 years ago

jacklaplante commented 8 years ago

Description

I want to use this docker-maven-plugin exclusively on one child module of my maven project.

How to reproduce

I tried putting the plugin only inside the pom of the child module. When I did mvn clean package docker:build it failed:

[ERROR] No plugin found for prefix 'docker' in the current project and in the plugin groups

If I put the plugin anywhere inside the parent pom (in <plugins> or pluginManagement) then it assumes that I'm making a docker container from the parent module and every child module.

What do you expect

I only want one container from one child module.

Software:

mattnworb commented 8 years ago

I believe you can tackle this in one of two ways

  1. you can configure the plugin in the parent pom's <plugins> section but default the plugin configuration to skip the docker build, and override that in the child module to not skip
  2. configure it only in the child module and bind the build goal to the package phase.
jacklaplante commented 8 years ago

I'm trying to get the docker build to skip by default by adding <skip>true</skip> to <configuration> but that isn't working. Is there a different way to do it?

mattnworb commented 8 years ago

The configuration property is named skipDockerBuild, not skip.

jacklaplante commented 8 years ago

Thanks for the help! It's very much appreciated.

sachinlala commented 7 years ago

I am trying this approach: configure it only in the child module and bind the build goal to the package phase

But still getting the same error.

Here is the snippet of how the plugin is sourced in the child module: `

        <plugin>
            <groupId>com.spotify</groupId>
            <artifactId>docker-maven-plugin</artifactId>
            <version>0.4.11</version>
            <configuration>
                <imageName>${docker.image.prefix}/${project.artifactId}</imageName>
                <dockerDirectory>.</dockerDirectory>
                <resources>
                    <resource>
                        <targetPath>/</targetPath>
                        <directory>${project.build.directory}</directory>
                        <include>${project.build.finalName}.jar</include>
                    </resource>
                </resources>
            </configuration>
            <executions>
                <execution>
                    <id>docker-build</id>
                    <phase>package</phase>
                    <goals>
                        <goal>build</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

`

Please can you review ?

Ademord commented 6 years ago

Any clear help on this on how to effectively build the docker image for a multi-module app?

mattnworb commented 6 years ago

@sachinlala

But still getting the same error.

can you clarify which error you are referring to?