title: Incrementing Maven Project Version with Jenkins/Git
body: <p>I'm using Jenkins to build Maven Java projects and deploy them to a Nexus repository. I also use Git, although I'm more used to Subversion so my Git knowledge is limited.</p>
  
  <p>I'd like Jenkins/Maven to:</p>
  
  <ol>
  <li>Merge feature branch into integration branch</li>
  <li>Build merged code, run unit tests</li>
  <li>If they pass, increment Maven version number</li>
  <li>Push merged code to origin's integration branch</li>
  <li>Deploy artifact to Nexus repository</li>
  </ol>
  
  <p>I gather the Git merging can be achieved thus: <a href="http://twasink.net/2011/09/20/git-feature-branches-and-jenkins-or-how-i-learned-to-stop-worrying-about-broken-builds/" rel="noreferrer">http://twasink.net/2011/09/20/git-feature-branches-and-jenkins-or-how-i-learned-to-stop-worrying-about-broken-builds/</a></p>
  
  <p>I've also read a lot about the <code>maven-release-plugin</code>. </p>
  
  <p>I'm not sure how exactly to achieve the above results. If I hardcode SCM details into each project's POM, then won't the <code>maven-release-plugin</code> be acting only on <em>that</em> repository rather than Jenkins' local one?</p>
  
  <p>If I use a solution of having Jenkins pass a environment variable to Maven to specify the version number, then I'd expect to have local version resolution issues in my IDE.</p>