When attempting to prepare a release using maven and the maven-release-plugin, you are currently very likely to see your build fail with a message such as:


[INFO] Executing: svn --non-interactive copy --file /tmp/...commit . https://subversion..../tags/...
[INFO] Working directory: ...
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Unable to tag SCM
Provider message:
The svn tag command failed.
Command output:
svn: Commit failed (details follow):
svn: File '...' already exists

If you do, you are using subversion 1.5.x which no longer supports tagging from a local working copy, thus causing the unfortunately very misleading error message.

This is a known issue of the subversion sourcecode management (SCM) and there is a simple workaround:

Use the latest 2.x snapshot version of the maven release plugin and configure it to use remote tagging (on the subversion server) rather than tagging from your local copy.

You can do so by

1.) Adding the apache snapshots repository to your plugin repositories list

    
        
            apache-snapshots
            Apache Snapshot Repository
            http://repository.apache.org/snapshots/
            
                true
            
        
        ...
    

2.) Configuring the release plugin’s version and tagging

        ...
        
        ...
        
            
                
                    org.apache.maven.plugins
                    maven-release-plugin
                    2.0-beta-9-SNAPSHOT
                    
                        full url to the tags directory on the svn server
                        
                        true
                        
                        clean install
                        true
                    
                
            
        
        ...
        
        ...

This fixed it for me.

Note: i had problems getting this to function with the scp:// protocol (provider) for my distribution repository. It seems logic, tough, that the choosen provider must support remote tagging, thus i choose the scpexe:// protocol (using a local scp executable) instead, that worked:

...


  myReo 
  myreo 
  scpexe://... 
 
...

...

Apparently, the upcoming 2.0 release of the maven-release-plugin will have remote tagging as default, so if you read this and the 2.0 version has been released, simply using it should do the job.

Share →

3 Responses to Running mvn:release with Subversion 1.5.x

  1. Andrey says:

    Hi, Olaf!

    Thanks for this very useful info about workaround, but I’ve got one more question.

    How do you make release:prepare with snapshot version of release plugin? Isn’t it complaining that you must release all snapshot dependencies before release?

  2. olaf says:

    Hi Andrey,

    The check for snapshot dependencies should be limited to the project dependencies of the <dependencies> section of the pom’s. There are, however, no such restrictions for the plugin-dependencies of the project, since they are not intended to be shipped with the artifacts generated by a build process but are part of the build process itself.

    Cheers,
    Olaf

  3. […] 2009/11/01 Good work Olaf, whoever you are! I only wish I had known this earlier: http://olafsblog.sysbsb.de/running-mvnrelease-with-subversion-15x/ […]

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>