title: Deriving maven artifact version from git branch
body: <p>We have a workflow requirement that essentially mean that we need to have the artifact version of a module externally defined from the current branch in git.</p>
  
  <p>I.e. if we are on the master branch in git, I need <code>&lt;version&gt;master-...&lt;/version&gt;</code> and if we are on the bugfixX branch, I need <code>&lt;version&gt;bugfixX-....&lt;/version&gt;</code> for the generated artifact for this pom.xml.</p>
  
  <p>I have previously found that <a href="https://github.com/koraktor/mavanagaiata">https://github.com/koraktor/mavanagaiata</a> can provide the SHA-1 hash as a property and it appears from the documentation that it can also provide the branch, so perhaps if it could be run early enough in the process we could set the property and just put <code>&lt;version&gt;${our.version}&lt;/version&gt;</code> in the pom.  If this is possible, I would very much like to see a working pom.xml (and reward a 500 point bounty for it too).</p>
  
  <p>If not, I guess we are into either preprocessing or "git checkout" do extra magic with some of the hooks (which I have not yet tried, working code would be great too).</p>
  
  <p>We have a top level pom, which can be run to generate a property file in ".." before building the modules where this functionality I'm asking about needs to go.</p>
  
  <p>Any suggestions on how to solve this?  </p>