title: multi-module Maven project on Dockers
body: <p>I have a multi-module maven project where the single modules are all runnable microservice applications containing their own Dockerfile, so in production every module will be a containerized application.</p>
  
  <p>The parent project, which contains the child-modules only contains the parent pom.xml and the docker-compose.yml</p>
  
  <p>I have tried to use the following Dockerfile (on sub-module level):</p>
  
  <pre><code>FROM sgrio/java-oracle
  
  RUN apt-get update
  
  RUN apt-get install -y maven
  
  COPY ../pom.xml /usr/local/service/Oogaday/pom.xml
  
  COPY pom.xml /usr/local/service/Oogaday/OogadayApi/pom.xml
  
  COPY src /usr/local/service/Oogaday/OogadayApi/src
  
  WORKDIR /usr/local/service/Oogaday/OogadayApi/
  
  RUN mvn package -DskipTests
  
  CMD ["java","-jar","org.oogaday.api-1.0-SNAPSHOT-jar-with-dependencies.jar"]
  </code></pre>
  
  <p>But I am getting a security error because I am  trying to copy the parent pom.xml file (which is not placed in the directory from which I am running the build).</p>
  
  <p>So is there a way to build a maven based sub-module with parent pom?</p>