title: maven 3: Accessing version of "root" corporate POM
body: <p>Using Maven 3.0.4.</p>
  
  <p>I am tasked with providing a corporate parent POM for our organization.  My team will provide support for questions or issues developers have when using this POM.  Often they will attach a build log to a support ticket.  So, I want my corporate POM to echo the version of the corporate parent to the console with any build.  I'm using the antrun plugin for this.</p>
  
  <pre><code>&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
  &lt;artifactId&gt;maven-antrun-plugin&lt;/artifactId&gt;
  &lt;executions&gt;
    &lt;execution&gt;
      &lt;id&gt;echo-build-environment&lt;/id&gt;
      &lt;phase&gt;validate&lt;/phase&gt;
      &lt;goals&gt;&lt;goal&gt;run&lt;/goal&gt;&lt;/goals&gt;
      &lt;configuration&gt;
        &lt;target&gt;
          &lt;echo level="info" message="Maven ${maven.version}" taskname="Version" /&gt;
          &lt;echo level="info" message="Corporate POMs ${want.the.version.here}" taskname="Version" /&gt;
        ....
       &lt;/target&gt;
  </code></pre>
  
  <p>Trick is, I have no idea how many "levels" of POM inheritance may come between the corporate parent and the POM used in the build.  We could have an inheritance structure something like this:</p>
  
  <pre><code>corporate-parent
    team-parent
      application-parent
        child-module
  </code></pre>
  
  <p>Or as simple as this:</p>
  
  <pre><code>corporate-parent
    a-simple-library
  </code></pre>
  
  <p>I cannot echo <code>${project.version}</code> as that will be the version of the current (child) project.  I cannot use <code>${project.parent.version}</code> because I have no idea how many levels of inheritance there might be.  I tried defining a <code>&lt;corporate.pom.version&gt;</code> property, hardcoded to the corporate POM version, however when I release my corporate POM the release plugin doesn't know to update that property (which makes sense, it's not a dependency version, it's just a property, the release version can't know to update it).</p>
  
  <p>Ideally, I'd love to be able to get the version of a specific POM directly through a property, something like <code>${some.groupId.corporate-parent.version}</code>.  Does anything like that exist?</p>
  
  <p>If not, is there a way during a release to update a POM property with the <code>releaseVersion</code> of the project being released?</p>
  
  <p>I could revert to the brute force way of manually editing the property before each release.  My teammates wouldn't appreciate that approach.</p>
  
  <p>I'm hoping I don't have to write a custom plugin to do something that at first glance didn't seem to be difficult.</p>