title: Maven build and release multiple interdependant projects
body: <p>I have some existing Maven projects.</p>
  
  <p>They are:</p>
  
  <ol>
  <li>aaa (plugin)</li>
  <li>bbb (jar)</li>
  <li>ccc (jar)</li>
  <li>ddd (war)</li>
  <li>eee (war)</li>
  </ol>
  
  <p><strong>Project <code>ddd</code> is for a customer and <code>eee</code> is for another</strong></p>
  
  <p>They are located in flat structure under <code>workspace/</code> folder on disk, and the very same structure is inside svn repo.</p>
  
  <p>This is the project's dependency hierarchy:</p>
  
  <pre><code>ddd (war)        
      aaa (plugin)
      bbb (jar)
      ccc (jar)
          bbb (jar)
  
  eee (war)
      ccc (jar)
          bbb (jar)
  </code></pre>
  
  <p>When only <code>war</code>s are <code>SNAPSHOT</code>s there's no problem in building and releasing</p>
  
  <p>otherwise, i.e.</p>
  
  <pre><code>ddd       1.1-SNAPSHOT (war)        
    aaa     2.0          (plugin)
    bbb     2.1-SNAPSHOT (jar)
    ccc     1.3-SNAPSHOT (jar)
      bbb   2.1-SNAPSHOT (jar)
  </code></pre>
  
  <p>I have to do, for building:</p>
  
  <ol>
  <li><code>bbb&gt; mvn install</code></li>
  <li><code>ccc&gt; mvn install</code></li>
  <li><code>ddd&gt; mvn compile</code></li>
  </ol>
  
  <p>and for release:</p>
  
  <ol>
  <li><code>bbb&gt; mvn release:prepare release:perform</code></li>
  <li><code>ccc&gt; mvn versions:use-releases</code></li>
  <li><code>ccc&gt; svn ci -m "updated SNAPSHOT dependencies"</code></li>
  <li><code>ccc&gt; mvn release:prepare release:perform</code></li>
  <li><code>ddd&gt; mvn versions:use-releases</code></li>
  <li><code>ddd&gt; svn ci -m "updated SNAPSHOT dependencies"</code></li>
  <li><code>ddd&gt; mvn release:prepare release:perform</code></li>
  </ol>
  
  <p>I tried with an aggregator, but</p>
  
  <ul>
  <li>on building, it compiles non SNAPSHOT dependencies (aaa 2.0 -> compiles aaa 2.1-SNAPSHOT)</li>
  <li>on releasing, it complains about scm, but I don't want the aggregator to be in svn</li>
  </ul>
  
  <p>This is what I need:</p>
  
  <ul>
  <li>single command build
  <ul>
  <li>orders SNAPSHOT dependecies</li>
  <li>installs (or deploy) each SNAPSHOT dependency</li>
  <li>builds (compile or package or install...) root artifact</li>
  </ul></li>
  <li>single command release
  <ul>
  <li>orders SNAPSHOT dependencies</li>
  <li>releases each SNAPSHOT dependency</li>
  <li>releases root artifact</li>
  </ul></li>
  </ul>
  
  <p>This is what I <strong>don't</strong> want:</p>
  
  <ul>
  <li>a batch build/release script</li>
  <li>put aggregators in svn</li>
  <li>version sharing among projects</li>
  <li>parent becomes an aggregator too</li>
  </ul>
  
  <p><strong>Is this possible?</strong></p>
  
  <p><strong>Alternative best practices? (maybe Jenkins will help?)</strong></p>
  
  <h1>Should I switch to Gradle??</h1>
  
  <hr>
  
  <p><strong>update</strong></p>
  
  <p>i see that most of you confuse <strong>parent</strong> with <strong>aggregator</strong>, so i removed it from this question. however,</p>
  
  <blockquote>
    <p>[...] You will often see projects that are both parents and aggregators. [...] However, although both POM projects, an aggregator project and a parent project are not one in the same and should not be confused. A POM project may be inherited from - but does not necessarily have - any modules that it aggregates. Conversely, a POM project may aggregate projects that do not inherit from it.</p>
  </blockquote>
  
  <p>from <a href="https://maven.apache.org/pom.html#Inheritance_v" rel="nofollow">A final note on Inheritance v. Aggregation</a></p>