The Mojo's Buildnumber Maven Plugin can fetch this information for you.
The project site has not been fully updated to reflect the fact that it works with GIT.
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
<doCheck>true</doCheck>
<doUpdate>true</doUpdate>
</configuration>
</plugin>
</plugins>
</build>
That will set the ${buildNumber}
property to the full GIT hash of your workspace.
It also will have the side-effect of ensuring that the build is the same on either a developers machine or the CI build server.