Generating unique builds

As we have seen, we use a SNAPSHOT version to specify that the project is under development. In the course of development, we will create several builds for the project. In many situations, it will be useful to distinguish one such build from another. One could be when we use continuous integration. Another would be when a tester needs to log defects against a build.

It would be nice if there was a way to generate a unique build number to identify a build in the case of SNAPSHOT versions.

How to do it...

  1. Open the project for which you want to have a build number (project-with-build-number).
  2. Add the following plugin configuration:
     <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>buildnumber-maven-plugin</artifactId> ...

Get Apache Maven Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.