Assuming you have a Github account setup you can use the maven-release-plugin to push the changes associated with a release to github. Further, assuming you have set up the github account with an ssh key you can configure the maven-release-plugin to push your changes not requiring entering a password every time a release is created. It appears to be canon to use the term “cut a release” for this activity. Eventually I’ll get around to asking my english speaking friends about this. Anyway, this requires you to have an <scm> element in your project description file. It must look like this:

<scm>
  <connection>scm:git:git@github.com:username/projectname.git</connection>
  <developerConnection>scm:git:git@github.com:username/projectname.git</developerConnection>
  <url>https://github.com/username/projectname</url>
</scm>

The data inside the elements is a colon separated (only the first two is significant for the plugin making up three partitions in all). The first two parts; scm and git tells it to use the maven-scm-plugin and its git executor. The rest is passed in as an argument. Now to the thing that made me spend a good amount of time before getting this to work. There is some debate on whether a “proper” URL shall end with a slash or not. I have been in the pro-add-slash camp and yesterday I came to regret it. It turns out that adding a trailing slash to the <developerConnection> makes the invocation of mvn release:prepare fail complaining about either missing repo or failure to authorize. The error messages led me to believe that I had constructed the data in error so I tried using ssh:// and slash instead of colon etc.

Another problem I encountered was when I tried to use the release:prepare-with-pom goal. I was then hit by MRELEASE-539.

The future for maven-release-plugin is questionable. The approach has been bemoaned and I do see there are merits to using an alternative approach like described especially since other, well working plugins are used in combination. It would probably be relatively easy to create a wrapper plugin to automate those tasks. Also, when Maven 4 arrives with continuous delivery support using maven-release-plugin looks even less fitting.

With hope this helps someone.



Published

22 March 2015

Category

programming

Tags