Continuous Integration with Bamboo and Maven, Managing Version Numbers

continuous integrationmavenversioning

I am currently developing a product that is broken up into a few main parts: A Server, an Android client, a Desktop client, and a class library for providing common data structures. Currently my team is using Maven (with a private Nexus repo) and TeamCity to do continuous integration, but we're having a ton of problems with builds failing due to version numbering issues. Our current solution involves using the Auto-Increment Versions Plugin for Maven, but any time we make any changes to our pom files we have to manually update the version of the pom file since the version of the pom in Git is now out of date.

My team and I have decided to look at Atlassian Bamboo, and since we are making changes to our workflow we would like to iron out these issues all at once. Here is what we are looking for:

  1. We want to specify a major and a minor build number (such as 0.3) and have the resulting artifact deployed to our repository as major.minor.auto-incrementing-build-number (such as 0.3.2, 0.3.3, 0.4.0).
  2. We want this to be as automatic as possible, since we have several developers and it only takes one person making a mistake to cause a disruption to everyone's workflow.
  3. We would prefer for this functionality to happen in Bamboo if possible, as Bamboo's "clone project" feature would allow us to replicate this functionality across multiple applications quickly, as well as keeping all of our pom files from having a ton of additional code for managing versions.

Has anyone had any experience doing something like this through Bamboo, or is there another approach that I should consider to make this easier?

Best Answer

I find using a snapshot approach using the maven snapshot functionality works fine out of the box.

Maven will automatically grab the latest snapshot release from the repository for a particular major/minor build number.

It then becomes only a matter of updating the major/minor version numbers when you do a release, and maven can do that for you as well through the maven::release command.

I normally use Jenkins/Hudson to build the release and upload the artefacts to the repository on completion of the build. I have used TeamCity before but find Jenkins a much more featured CI utility.