Just for clarity, here's the solution using groovy:
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<providerSelection>2.0</providerSelection>
<properties>
<script>git rev-list master --count</script>
</properties>
<source>
def command = project.properties.script
def process = command.execute()
process.waitFor()
def describe = process.in.text.trim()
println "setting revision to: " + describe
project.properties.setProperty('gitVersion',describe)
</source>
</configuration>
</execution>
</executions>
</plugin>