I\'ve got a project at version 0.0.1-SNAPSHOT, and when we build it via TeamCity, we also get a build.vcs.number property, which is the Subversion revision that triggered th
I realize this question is a tad dated, but I just ran into a similar situation, and this is how I resolved it:
org.codehaus.mojo
build-helper-maven-plugin
1.8
parse-version
parse-version
What this build-helper plugin's "parse-version" mojo will do is give you the following properties that you can use as you see fit:
parsedVersion.majorVersion
parsedVersion.minorVersion
parsedVersion.incrementalVersion
parsedVersion.qualifier
parsedVersion.buildNumber
That should cover all of your desired version "parts." I'm currently using this to build chrome extensions in which the manifest version cannot include "-SNAPSHOT" and must be at most 4 numbers separated by dots. In my use case, I use this combination to produce the desired result:
"version":"${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}"
So, I'm essentially stripping of "-SNAPSHOT" so my local dev copies of my extension will install properly for testing. You can build whatever you want with the pieces. =)