Ever since Bamboo introduced Plan and global variables they’ve been used extensively across all our instances. In particular, I often see variables like this:

Obviously, those are Maven versions.  When a release happens, or when a version changes, these variables are often forgotten –leading to broken builds for no good reason & wasted developer time. It’s particularly problematic if you want versions to auto-increment each time you run a plan so you can keep track of where you are. So I wrote a task that does the updating for you.  Meet the Maven Version Updater for Bamboo Variables.   (What it lacks in clever naming, it makes up for in usefulness.  Promise.)

Specify a regex which the Task will use to find the variables to update, and when it runs…

By default it works against Plan variables, but you can make it search for global variables too.

This new Task is best used as part of a Plan (or Job) that is run only when a version is being released and/or deployed.  Why?  Because the Task will auto-increment your variables regardless of whether the version in your POM has actually changed.  So it’s not really suitable for running as part of your normal CI Plan that gets executed several times a day.  The next step is making it a “version sync” Task that will compare the POM’s version and your variable and just make sure they’re the same value.

Give it a Spin!

I haven’t released this plugin on Atlassian Marketplace yet, but you can get my latest beta build here and install it (Administration > Plugin Manager > Install Plugins > Upload Plugin).  Definitely drop comments and suggestions here after you’ve had a chance to check it out!

If you want to further customize it for your own project, create a free Bitbucket account and fork the code from this public repository.  Cheers!