Using Maven, Git: How do I tag the latest version of my code?
The maven-release-plugin can do this for you -- see an example here: http://maven.apache.org/plugins/maven-release-plugin/examples/prepare-release.html
Use Maven SCM plugin. See tag functionality in advanced features, which should be relevant.
Now, git support doesn't come out of the box, so you'll need a dependency to maven-scm-provider-gitexe. Also, to overcome plexus exception issue, you'll also need to add a dependency to a later version of plexus.
This is what worked for me:
<project>
<scm>
<connection>scm:git:https://[email protected]/my-project.git</connection>
<developerConnection>scm:git:https://[email protected]/my-project.git</developerConnection>
</scm>
<!-- snip -->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-gitexe</artifactId>
<version>1.2</version>
</dependency>
</dependencies>
<version>1.0</version>
<configuration>
<tag>test</tag>
<connectionType>connection</connectionType>
</configuration>
<executions>
<execution>
<id>tag</id>
<phase>deploy</phase>
<goals>
<goal>tag</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<!-- snip -->
</project>