Today I’ve been trying to perform a maven release on a project hosted on google-code and I’ve hit a major roadblock.
The build was failing due to a SVN error occurring when maven was committing into SVN, into the tags folder, the current version of the project:
[INFO] Unable to tag SCM
The svn tag command failed.
svn: Commit failed (details follow):
svn: File '/svn/path/to/my/file/myclass.java' already exists
The solution is rather a workaround, than a solution: force a svn update before committing the code into SVN repository.
Searching to see if other people have had a similar problem I discovered this bug, and in one of the comments of the bug I saw the workaround:
# mvn release:prepare
== fails ==
# svn up -r head
# mvn release:prepare -Dresume
As you can see, you are being suggested to do a svn update after the build fails and resume the release process from that point.
I tested this workaround, and luckily for me, it worked. Going further, I thought that’s great, but how can I deal with these extra steps on my continuous integration machine ? I didn’t want to create a special job just to do the release of my library, so I started to see if I can integrate this workaround into a single maven command line.
Looking into the
Maven Release Plugin, I discovered the preparationGoals property. As the documentation specifies, it defines which “goals to run as part of the preparation step, after transformation but before committing.“.
Into these preparation goals I executed a shell command, using
Maven Exec Plugin.
mvn -e release:clean release:prepare release:perform \
-DpreparationGoals="clean install exec:exec" \
This single command did in the end the same thing. Forced a svn update before committing the code into SVN.
Apparently this bug occurs only for SVN versions up to 1.6.4. In SVN version 1.6.5 this shouldn’t be a problem anymore. Too bad that Google Code uses older versions of SVN.