Book Image

Apache Maven Cookbook

Book Image

Apache Maven Cookbook

Overview of this book

Table of Contents (18 chapters)
Apache Maven Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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>
            <version>1.3</version>
            <executions>
              <execution>
                <phase>validate</phase>
                <goals>
                  <goal&gt...