I have a Java project, which is still in a very early stage. There are no real releases yet, so I set version as 1.0.0-SNAPSHOT in my pom.xml.
Before each submit, I perform a Sonar analysis directly from Maven using:
mvn sonar:sonar
Sonar has this nice ability to record changes of KPIs over time. However, it only does that for a version. Now, as I don’t update my version number, it overrides the last analysis result and replaces it with the current one.
I wonder how to get around that. I don’t want to increase version numbers manually each day as this doesn’t seem very natural to me.
What other options do I have? Should I use one of the Maven plugins to add a build number to the version string so that I have unique versions? Do you have any other strategy?
If you want increase version number every release, the maven release plugin is recommendation.
But if you want increase the version number everyday even every build, you can use unique version number like timestamp which can get from Maven building phase, after Maven 2.1, it has the built-in
${maven.build.timestamp}you can use, and you can use formatfor more information you can visit http://maven.apache.org/guides/introduction/introduction-to-the-pom.html