Maven Release Plugin for Github Projects
I always forget to update the version of software in the pom.xml
file when
performing a release so, after someone suggested we sort this out,
I looked into how to setup the maven release plugin for github.
I could not find clear, example based, documentation, hence this post.
Step 1 - SSH Keys
It will be far easier to use github over SSH with the release plugin.
You will need to follow this guide to Connecting to GitHub with SSH.
Step 2 - SCM Details
There is a SCM tag in the pom.xml
which will need to look something like:
<scm>
<connection>scm:git:git@github.com:my-account/my-project</connection>
<url>scm:git:git@github.com:my-account/my-project</url>
<developerConnection>scm:git:git@github.com:my-account/my-project</developerConnection>
<tag>HEAD</tag>
</scm>
Step 3 - Maven Release Plugin
Add the release plugin to your pom.xml
file:
<build>
</plugins>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<useReleaseProfile>false</useReleaseProfile>
<tagNameFormat>v@{version}</tagNameFormat>
</configuration>
</plugin>
</plugins>
</build>
Step 4- Profit (aka automatically release new version)
Run mvn release:prepare
and follow the prompts.
For more information see the maven release plugin docs.
As always, if you have any comments please contact me.