Wednesday, April 14, 2010

Adding a version number with Maven

Sometimes it's handy to be able to see the version number of the application somewhere on a page. The version number should ideally be "inserted" by Maven while it's building. I.e something like:

<div id="footer">
Version: 1.1

An easy way to do it is by adding the following 2 plugins to the build section of the POM.

The template just contains the following somewhere

<h:outputText value="Version: @VERSION_NUMBER@"/>