title: Fully automate release procedure with release+versions plugins
body: <p>Would be great if Maven guru community can help me with the following task.</p>
  
  <p>I would like to automate the release process of Maven module in Hudson in a way that release process runs in batch mode (does not need anything to be asked from console). Currently I use common steps <code>release:prepare</code> (with <code>&lt;preparationGoals&gt;versions:update-parent clean verify&lt;/preparationGoals&gt;</code> to update parent to latest version before commit) + <code>release:perform</code>. However I would like Maven to do the following:</p>
  
  <p>Somewhen during preparation step:</p>
  
  <ul>
  <li>For all dependencies which match the <code>groupId</code> of the current module <em>and parent</em>, replace <code>-SNAPSHOT</code> with released version (e.g. <code>versions:use-releases -Dincludes=???</code>).</li>
  </ul>
  
  <p>Somewhen after release:</p>
  
  <ul>
  <li>For all dependencies which match the <code>groupId</code> of the current module <em>and parent</em>, replace release version with <code>-SNAPSHOT</code> version (e.g. <code>versions:use-latest-snapshots ...</code>).</li>
  </ul>
  
  <p>Example:</p>
  
  <pre><code>&lt;parent&gt;
      &lt;groupId&gt;org.mycompany.myproject&lt;/groupId&gt;
      &lt;artifactId&gt;myproject-parent&lt;/artifactId&gt;
      &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
  &lt;/parent&gt;
  
  &lt;dependency&gt;
      &lt;groupId&gt;${project.groupId}&lt;/groupId&gt;
      &lt;artifactId&gt;myproject-api&lt;/artifactId&gt;
      &lt;version&gt;1.1-SNAPSHOT&lt;/version&gt;         
  &lt;/dependency&gt;
  </code></pre>
  
  <p>before module is tagged is transformed into:</p>
  
  <pre><code>&lt;parent&gt;
      &lt;groupId&gt;org.mycompany.myproject&lt;/groupId&gt;
      &lt;artifactId&gt;myproject-parent&lt;/artifactId&gt;
      &lt;version&gt;1.0&lt;/version&gt;
  &lt;/parent&gt;
  
  &lt;dependency&gt;
      &lt;groupId&gt;${project.groupId}&lt;/groupId&gt;
      &lt;artifactId&gt;myproject-api&lt;/artifactId&gt;
      &lt;version&gt;1.1&lt;/version&gt;          
  &lt;/dependency&gt;
  </code></pre>
  
  <p>and after release is succeeded is transformed into:</p>
  
  <pre><code>&lt;parent&gt;
      &lt;groupId&gt;org.mycompany.myproject&lt;/groupId&gt;
      &lt;artifactId&gt;myproject-parent&lt;/artifactId&gt;
      &lt;version&gt;1.1-SNAPSHOT&lt;/version&gt;
  &lt;/parent&gt;
  
  &lt;dependency&gt;
      &lt;groupId&gt;${project.groupId}&lt;/groupId&gt;
      &lt;artifactId&gt;myproject-api&lt;/artifactId&gt;
      &lt;version&gt;1.2-SNAPSHOT&lt;/version&gt;         
  &lt;/dependency&gt;
  </code></pre>
  
  <p>I feel like it needs a mixture of</p>
  
  <p><code>versions:use-releases scm:commit release:prepare release:perform versions:use-latest-snapshots scm:commit</code></p>
  
  <p>but I am not sure what is the best way of doing this. Especially it would be nice to have as less commits as possible: the difficulty is that <code>reparationGoals</code> are run after <code>-SNAPSHOT</code> version check.</p>
  
  <p>The described project is not a multi-module project in a sense that parent POM is not referring it's children via <code>&lt;modules&gt;</code>. SCM structure is the following:</p>
  
  <pre><code> .
   |
   +-- myproject-parent
   |   +-- pom.xml
   +-- myproject-api
   |   +-- pom.xml
   +-- myproject-impl
       +-- pom.xml
  </code></pre>
  
  <p>Dependencies are:</p>
  
  <pre><code>myproject-api → myproject-parent
  myproject-impl → myproject-parent
  myproject-impl → myproject-api
  </code></pre>
  
  <p>The project's parent POM (<code>myproject-parent</code>) will be released rarely and thus will be released first. Then <code>myproject-api</code> (if necessary) and then <code>myproject-impl</code>.</p>