title: Maven - making child projects that can be independent of their parent
body: <p>I'm a bit of a Maven newb, and I'm trying to setup a maven project that builds several child projects, but still allows someone to just grab one of the child projects and build it independently without the parent.</p>
  
  <pre><code>parentfolder
    -&gt;pom.xml
    -&gt;project1
      -&gt;pom.xml
      -&gt;src
    -&gt;project2
      -&gt;pom.xml
      -&gt;src
    -&gt;project3
      -&gt;pom.xml
      -&gt;src
  </code></pre>
  
  <p>Basically I want someone to be able to checkout parentfolder and do mvn compile to build all the projects, and also for someone to be able to checkout just project1 and do mvn compile to build just it.</p>
  
  <p>I've tried declaring the sub-projects as modules in the top-level pom.xml, </p>
  
  <pre><code>&lt;modules&gt;
    &lt;module&gt;project1&lt;/module&gt;
    &lt;module&gt;project2&lt;/module&gt;
    &lt;module&gt;project3&lt;/module&gt;
  &lt;/modules&gt;
  </code></pre>
  
  <p>But that seems to require that the parent pom.xml info is declared in the children. This makes the child projects dependent on the parent pom.xml being present, which is what I wanted to avoid.</p>