title: Build multi maven modules then copy JARs inside a docker image
body: <p>I have a multi-modules project configured with maven.</p>
  
  <pre><code>/myProject
    /module1
      /target
      pom.xml
    /module2
      /target
      pom.xml
    pom.xml
  </code></pre>
  
  <p>The pom parent is building the submodules.</p>
  
  <p>Using the <em>com.spotify.dockerfile-maven-plugin</em> I want to build all the modules, build a docker image and copy all the JARs inside that image.</p>
  
  <p>The pom parent</p>
  
  <pre><code>&lt;project&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;com.test&lt;/groupId&gt;
      &lt;artifactId&gt;myTest&lt;/artifactId&gt;
      &lt;name&gt;test&lt;/name&gt;
      &lt;version&gt;0.0.1&lt;/version&gt;
      &lt;packaging&gt;pom&lt;/packaging&gt;
  
      &lt;modules&gt;
          &lt;module&gt;module1&lt;/module&gt;
          &lt;module&gt;module2&lt;/module&gt;
      &lt;/modules&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>If I put a Dockerfile at the root of /myProject, the plugin complains there is no Dockerfile for module1</p>
  
  <pre><code>FROM openjdk:8-jdk-alpine
  ARG JAR_FILE
  COPY ${JAR_FILE} /home/xyz/jars
  </code></pre>
  
  <p>maven plugin:</p>
  
  <pre><code>    &lt;plugin&gt;
          &lt;groupId&gt;com.spotify&lt;/groupId&gt;
          &lt;artifactId&gt;dockerfile-maven-plugin&lt;/artifactId&gt;
          &lt;configuration&gt;
              &lt;repository&gt;mytest&lt;/repository&gt;
              &lt;buildArgs&gt;
                  &lt;JAR_FILE&gt;target/${project.artifactId}-${project.version}.jar&lt;/JAR_FILE&gt;
              &lt;/buildArgs&gt;
          &lt;/configuration&gt;
      &lt;/plugin&gt;
  </code></pre>
  
  <p>This works fine with one module if I put the Dockerfile inside that module but how to do with multiple modules and only 1 Dockerfile?</p>
  
  <p>Can I build the submodules and then the docker image with a single <code>mvn clean install</code> on the parent pom?</p>
  
  <p>Maybe by creating a submodule only with a pom and the Dockerfile?</p>