Friday, May 14, 2010

The correct Maven release plugin in may 2010 UPDATED

In my current contract we use subversion for source control and maven2 for release management.

Release plugin running even when there are mods
I've been using the maven-release-plugin for years without issue however recently we realised that using maven 2.1.0 and release plugin 2.0-beta-8 allowed releases with working copy modifications. This is a major drawback it means if different people makes tags of the same artifact they might be different even if made seconds apart and one of the reasons for using the release plugin in the first place.

After a day of testing different combinations i've ended up using Maven 2.1.0 and release-plugin 2.0-beta-9 with remoteTagging disabled. Why?

Why Maven 2.1.0 and maven-release-plugin 2.0-beta-9
We use ranges and release plugin v2.0 can't resolve ranges.

Maven 2.2.1 generates bad checksums for the repository metadata (or calculates it incorrectly locally) so when you are resolving dependencies you get checksum warnings everywhere, not a good look for a professional contractor to leave warning all over and build and release process. So Maven 2.2.1 is out.

Release plugin 2.0-beta-8 does not fail when there are working copy modifications.

Remote tagging. Well after thinking about that for a few minutes I realised it was a terrible idea so I switched it off.

In nearly every project I've ever worked on you don't need to generate a site for each artifact, attaching the sources is sufficient for IDE's and well they don't really have a site. If there was decent aggregation my depedencies into one site I might use it. But doing site just slows it down. All the test reports are in hudson anyway.

And then I realised it didn't work
You have to force the scm version being used too. Which is not too hard just set the dependency for the plugin

The resultant config

<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.0-beta-9</version>
<configuration>
<preparationGoals>clean enforcer:enforce verify</preparationGoals>
<goals>enforcer:enforce deploy</goals>
<tagBase>${svn.repo.base.url}/tags/release/${project.groupId}/</tagBase>
<remoteTagging>false</remoteTagging>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-svnexe</artifactId>
<version>1.3</version>
</dependency>
</dependencies>
</plugin>

No comments:

Post a Comment