Issue Details (XML | Word | Printable)

Key: SCM-406
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Olivier Lamy
Reporter: James William Dumay
Votes: 98
Watchers: 86
Operations

If you were logged in you would be able to see more operations.
Maven SCM

scm tag does not work with Subversion 1.5.1

Created: 22/Aug/08 01:08 AM   Updated: 10/Sep/09 04:58 AM   Resolved: 16/Mar/09 07:30 PM
Return to search
Component/s: maven-scm-provider-svn
Affects Version/s: 1.0
Fix Version/s: 1.2

Time Tracking:
Not Specified

Issue Links:
Duplicate
 
Related

Complexity: Intermediate


 Description  « Hide

scm:checkin does not work with Subversion 1.5.1

On release:perform (which I assume calls scm:checkin) the following error occurs:

svn: File '/svn/private/atlassian/confluence/tags/confluence-project-2.10-m1/conf-acceptance-test/pom.xml' already exists

Using subversion 1.4.x is a good enough workaround.



James William Dumay added a comment - 22/Aug/08 01:08 AM

I'd like to also add that I've tested this on both Ubuntu linux and Mac OS X 10.5 using the CollabNet binaries.


James William Dumay made changes - 22/Aug/08 01:10 AM
Field Original Value New Value
Link This issue is related to MRELEASE-375 [ MRELEASE-375 ]
Vincent Siveton made changes - 31/Aug/08 07:32 AM
Fix Version/s 1.1.1 [ 14522 ]
Olivier Lamy added a comment - 31/Aug/08 10:52 AM

Are you sure it's not a subversion tool issue ?


James William Dumay added a comment - 31/Aug/08 08:23 PM

Not sure - it could be some variation of the --non-interactive issues that have been cropping up now and again. Ill setup a debugger and check it out again.


James William Dumay added a comment - 31/Aug/08 09:19 PM

I can confirm that this is a tooling problem in maven.

The command executed is:

svn --non-interactive copy --file /tmp/maven-scm-33408250.commit . https://svn.atlassian.com/svn/private/atlassian/release-testing/tags/maven-release-testing-2

James William Dumay added a comment - 31/Aug/08 09:20 PM

Changing the summary to show the correct name of operation.


James William Dumay made changes - 31/Aug/08 09:20 PM
Summary scm:checkin does not work with Subversion 1.5.1 scm tag does not work with Subversion 1.5.1
James William Dumay added a comment - 01/Sep/08 12:21 AM

Vincent Siveton added a comment - 03/Sep/08 08:06 PM

I got this issue. Here are some workarounds from dkulp and olamy:

# mvn release:prepare
=> fails
# svn up -r head 
# mvn release:prepare -Dresume

using latest svn in your path and call svn cleanup (if you used TortoiseSVN, kill the TSVNCache too)


Grégory Joseph added a comment - 08/Sep/08 12:37 PM

Has anyone had a chance to test with a 1.5.2 client ? (source released Aug 30th, no binary for osx yet, afaik)


Grégory Joseph added a comment - 08/Sep/08 01:31 PM - edited

Good news, I guess: using the macports.org port of the subversion client 1.5.2, this now seems to work.
edit: i spoke too fast: it seems to work for single module projects (which was maybe the case with 1.5.1 too) but not with multi-module projects.


James William Dumay added a comment - 08/Sep/08 09:15 PM

I can still confirm this issue with the SVN 1.5.2 release.


Michael Johns added a comment - 11/Sep/08 12:53 PM

I have a little color I can add to this discussion. We too use Maven, but I'm 99% sure this has nothing to do with it. Here's what I've done:

  1. Ran a release in Maven; failed with the error everyone else is seeing (svn: File '...' already exists) 2. In a command prompt on our build box, changed to the project's working directory that was created by the Maven build. From there, ran a "svn --non-interactive copy -m <message> . <test destination>" manually (same command that Maven runs, save for an explicit message rather than --file). Got the same error.
  2. Queried the working copy to see if any files were changed. No files were changed, but about 10 new files were present (relics from the aborted build).
  3. Deleted the new files and ran the command again. Failed again with same error.
  4. Ran an update on my working copy. No changes happened (no new files, deleted files, or changed files), but something happened because...
  5. Ran the command again, and it worked.

Some things to note:

  • We have a multi-module project.
  • We're on Windows Server 2003.
  • I installed SVN using various methods (msi, unzip), and they all fail. We have 1.5.2 with the Apache 2.0 bindings.
  • This problem doesn't happen with SVN 1.5.0, but it does happen with 1.5.1.

To me, this most definitely appears to be a SVN bug. I've also posted this to the subversion users mailing list since it's really more relevant to them. But I figured I'd cross-post it here to help exonerate Maven as the culprit.


Olivier Lamy made changes - 12/Sep/08 07:07 AM
Link This issue is duplicated by MNG-3752 [ MNG-3752 ]
Alison Winters added a comment - 28/Sep/08 11:10 PM

This does appear to be an SVN "bug" in the sense that it doesn't let you tag from a non-head revision, even if all the files in and below the current directory are in fact at the latest revision for that directory on the repository. I think perhaps Maven should hide this by explicitly running an svn up prior to the svn copy - it makes sense anyways because presumably you do always want to release from the head version of what's in the repository.


Yann Albou added a comment - 14/Oct/08 03:41 PM

This issue still happens with SVN 1.5.3
I don't know if it is an issue on SVN or on Maven side, but the issue can be resolved if we tag from repository instead of tagging from the local version.
There is an open issue on this subject: SCM-262


Olivier Lamy made changes - 04/Nov/08 04:09 PM
Link This issue is duplicated by CONTINUUM-1959 [ CONTINUUM-1959 ]
Kyle Lebel added a comment - 05/Nov/08 05:34 PM

Hey guys, I downloaded the source code for the multiple dependencies (maven-release-plugin, maven-release-manager, maven-scm-providers-svn).

If the maven-release-plugin you have is configured to use the latest, it will use 1.1 version of the maven-scm-providers. Simply changing the following line 162 in SvnTagCommand resolves this issue:

cl.createArgument().setValue( "." );
to
cl.createArgument().setValue( repository.getUrl() );

So not sure if someone would want to make an official revision for this. For now I will deploy this to our local maven repository.


Kyle Lebel added a comment - 05/Nov/08 06:04 PM

Actually just after posting my comment I noticed this was already fixed in 1.1.1 - I guess the next step then to make this official is updating maven-release-plugin / manager? Anyone know the plans for this?


Matthias Weßendorf added a comment - 11/Nov/08 07:50 AM

even wores, if your trunk is not named trunk... (b/c it is sometimes that case to have two trunks (to work on different "JSR specs")) but "trunk12_x"

Anyway, so I run the plugin like :
mvn release:prepare -DprepareRelease=true -Dresume -Dtag=http://svn.apache.org/repos/asf/myfaces/trinidad/tags/trinidad-1.2.10

now... I get this:
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Unable to tag SCM
Provider message:
The svn tag command failed.
Command output:
svn: Server sent unexpected return value (403 Forbidden) in response to MKACTIVITY request for '/repos/asf/!svn/act/32a097b1-8097-af46-a3c1-55150b6042bd'

[INFO] ------------------------------------------------------------------------


Matthias Weßendorf added a comment - 11/Nov/08 08:04 AM

for the problem above I had to do this:
http://svn.apache.org/viewvc?view=rev&revision=713040

now a "mvn release:prepare -DprepareRelease=true -Dresume" does the trick:

However, still some clean ups, to be consistent:
http://svn.apache.org/viewvc?view=rev&revision=713043
http://svn.apache.org/viewvc?view=rev&revision=713044


Kalle Korhonen added a comment - 11/Nov/08 11:17 AM

Upgrading to svn 1.5.4 fixes the issue


George Gastaldi added a comment - 17/Nov/08 09:00 PM

Kalle, I upgraded to 1.5.4 and the problem was not solved.


Kalle Korhonen added a comment - 21/Nov/08 02:19 PM

Try together with release plugin 2.0-beta-8 - though I'm now seeing some oddities, need to verify it's not a user error when I release our project the next time (in a week)


Tomislav Stojcevich added a comment - 21/Nov/08 03:44 PM

svn 1.5.4 with release plugin 2.0-beta-8, the problem still exists


Kuno Baeriswyl added a comment - 26/Nov/08 07:40 AM

I'd like to confirm that the problem still exists with svn 1.5.4 and release plugin 2.0-beta-8 (on Windows). Does anybody know if there is an offical bugreport from the subversion team I could track?


Kalle Korhonen added a comment - 27/Nov/08 01:57 AM

Agree, still a problem in svn 1.5.4, sorry for the noise. Only one of our project succeeded a release without issues because of a funny side effect of using the buildnumber plugin - it does svn update as part of the build (if configured so); which as other have pointed out, you can do manually as well to continue release:prepare after it fails the first time.


Torsten Juergeleit added a comment - 27/Nov/08 05:52 AM - edited

Creating a copy (tag) on a working directory after performing a commit with SVN 1.5.1-1.5.4 seems to be an SVN issue
(please refer to Error when creating tags from working copy).

How about implementing the code change (using "cl.createArgument().setValue( repository.getUrl() );" instead of "cl.createArgument().setValue( "." ); ") suggested here by Kyle Lebel or in SCM-262?


Torsten Juergeleit made changes - 27/Nov/08 06:01 AM
Link This issue relates to SCM-262 [ SCM-262 ]
Torsten Juergeleit added a comment - 27/Nov/08 06:01 AM

This would fix SCM-262


George Gastaldi added a comment - 27/Nov/08 06:48 AM

Torsten,

If applied that patch, you could not solve the worst scenario: others may commit on trunk, so the tag created could not really be the one that you checked out and ran tests/packaged locally.

What do you guys think about it ?


Torsten Juergeleit added a comment - 27/Nov/08 09:02 AM

George,

you're right. Hard-coding the update to trunk like the patch in SCM-262 doesn't fly.

So how about the workaround suggested by Alison Winters to do "svn update" prior to the "svn copy" in ScmTagPhase?
Maybe something like

Index: src/main/java/org/apache/maven/shared/release/phase/ScmTagPhase.java
===================================================================
--- src/main/java/org/apache/maven/shared/release/phase/ScmTagPhase.java	(revision 720901)
+++ src/main/java/org/apache/maven/shared/release/phase/ScmTagPhase.java	(working copy)
@@ -61,8 +61,6 @@
 
         validateConfiguration( releaseDescriptor );
 
-        logInfo( relResult, "Tagging release with the label " + releaseDescriptor.getScmReleaseLabel() + "..." );
-
         ScmRepository repository;
         ScmProvider provider;
         try
@@ -80,12 +78,35 @@
             throw new ReleaseExecutionException( "Unable to configure SCM repository: " + e.getMessage(), e );
         }
 
+    	// TODO: want includes/excludes?
+        ScmFileSet fileSet = new ScmFileSet( new File( releaseDescriptor.getWorkingDirectory() ) );
+        
+        // Due to a Subversion bug http://subversion.tigris.org/servlets/BrowseList?list=users&by=thread&from=686753
+        // regarding the tag command (svn copy) we need to update the working directory first! 
+        if ("svn".equals(provider.getScmType()))
+        {
+	        UpdateScmResult result;
+	        try
+	        {
+            	logInfo( relResult, "Due to a Subversion bug we have to update the working directory before tagging ..." );
+            	result = provider.update( repository, fileSet );
+	        }
+	        catch ( ScmException e )
+	        {
+	            throw new ReleaseExecutionException( "An error is occurred while updating working directory: " + e.getMessage(), e );
+	        }
+	
+	        if ( !result.isSuccess() )
+	        {
+	            throw new ReleaseScmCommandException( "Unable to update working directory", result );
+	        }
+        }
+        
         TagScmResult result;
         try
         {
-            // TODO: want includes/excludes?
-            ScmFileSet fileSet = new ScmFileSet( new File( releaseDescriptor.getWorkingDirectory() ) );
             String tagName = releaseDescriptor.getScmReleaseLabel();
+            logInfo( relResult, "Tagging release with the label " + tagName + "..." );
             result = provider.tag( repository, fileSet, tagName,
                                    releaseDescriptor.getScmCommentPrefix() + " copy for tag " + tagName );
         }

Kyle Lebel added a comment - 27/Nov/08 09:12 AM

This is true. My suggestion is flawed in a scenario where many developers risk committing to the trunk while building tags. In our situation, there are often many projects on the go with a manageable amount of developers (2-5) working on them. While building tags, we communicate to them to not commit to the trunk until the release is completed.

But obviously this does not cover all scenarios.


George Gastaldi added a comment - 27/Nov/08 09:54 AM

And how about using SVNKit (http://www.svnkit.com) as the SVN provider ?
Or another java implementation of SVN Client ? Is that possible ?


Thomas Dreyer added a comment - 27/Nov/08 10:40 AM

Using subversion 1.5.0 is also a good workaround for the moment.

As Peter writes in his blog: http://osi.fotap.org/2008/07/30/svn-151-breaks-maven-release-plugin/
CollabNet Subversion 1.5.0 download: http://downloads-guests.open.collab.net/servlets/ProjectDocumentList?folderID=6


Alison Winters added a comment - 27/Nov/08 04:44 PM

I think Torsten is on the right track here. If you svn update the directory before tagging it will work by using the current directory ("."). To protect against the scenario where someone else might have updated trunk in between i think we could look at the following fix (sorry for pseudo code, i'm not familiar enough with the Maven internals to provide a real patch).

boolean forceUpdate = getForceUpdateArgument();
int revision = getHeadRevision();
if (!forceUpdate && hasChanges(revision)) {
  println("Head revision has the following changes, do you wish to update?");
  printChanges(revision);
  if (!yesNo()) {
    return;
  }
}
update(revision);
doTag(".");

There is still a tiny race condition where someone checks something into head in between when you get the latest revision number and when you hit "yes" in non-force-update mode, but if that fails then it's no worse than the situation right now. This will at least fix the case for most of us who have segmented trees where it is very unlikely we will be tagging something from a branch that anyone else is simultaneously editing.


Alison Winters added a comment - 27/Nov/08 04:54 PM

Just to clarify possible ambiguity in my pseudocode:

getForceUpdateArgument() - command line argument to Maven
getHeadRevision() - svn info http://server/path/to/repository@HEAD
printChanges()/hasChanges() - svn status -u . (filtered to changes < $revision)
update() - svn update -r $revision .


Yann Albou added a comment - 30/Nov/08 08:29 AM

Why not using the SVN lock and then release lock when the tag is done ?

By doing this we will prevent others to commit changes during the tag.


Kuno Baeriswyl added a comment - 09/Dec/08 07:41 AM

[Using subversion 1.5.0 is also a good workaround for the moment. ]

Unfortunately, it isn't. Generally, this version is not recommended for productive use. And I've got other show stoppers using this version.


Johannes Schneider added a comment - 09/Dec/08 08:06 AM

Please fix this! It has been reported a few months ago and is a real show stopper.
Most of the people out there use Subversion - and nearly everyone has to release a piece of software somewhen...

I really wait for some competition for Maven....

Sorry for ranting - but sometimes it is necessary...


Justin Edelson added a comment - 09/Dec/08 09:24 AM

Does anyone know if an issue has been filed with Subversion for this? Has it been acknowledged as a bug on their end?


Al Robertson added a comment - 10/Dec/08 01:25 PM

Following up Johannes's rant... this IS a real problem for us too!
Can I assume everyone else using Maven/Subversion has not upgraded to 1.5.x? Otherwise - not using the release plugin. I guess I thought it would be effecting more people than the 55 voters.
We have a server running 1.4.x specifically for releasing at the moment. It also means we can't upgrade the subversion repos to 1.5 until this is fixed.
I know the answer - fix it yourself. I just felt I needed to comment on this one because it's stopping us using svn 1.5.


George Gastaldi added a comment - 10/Dec/08 01:29 PM

Al,

You may upgrade your server to svn 1.5, and use svn client 1.5.0 (download link in previous comments). This is what I am using now.

Regards,

George Gastaldi


Kent Lam added a comment - 10/Dec/08 01:30 PM

I made a bat file to do the release, this is what i do in the script until this problem is fixed:

echo Preparing the release...
call mvn release:clean release:prepare -Darguments=-Pproduction
if %ERRORLEVEL% NEQ 0 goto retry

:retry
echo !!! Failure could be due to SVN 1.5 problem of tagging http://jira.codehaus.org/browse/SCM-406, Going to update, then retry mvn release:prepare!!!
svn up
call mvn release:prepare -Darguments=-Pproduction
if %ERRORLEVEL% NEQ 0 goto failed
goto preparesuccess

:preparesuccess
echo *** Please confirm that the Prepare was successful!
echo *** Ctrl-C if the Prepare was NOT successful.
pause

:failed
cd
echo !!! Failed to release! Please fix issues and rerun script.
goto finished


Clint Gilbert added a comment - 10/Dec/08 01:57 PM - edited

George,

I've heard that there are some major problems with SVN 1.5.0 that are fixed with later releases, potentially making 1.5.0 a bad option. Can anyone elaborate on this?


Clint Gilbert added a comment - 10/Dec/08 02:06 PM

It makes sense to tag from the local copy, since that's the code that's just been compiled and tested. Someone could have checked in a breaking change to the trunk which you wouldn't want in the release, for instance.

But how about this (I'm just brainstorming; I don't know enough about the SCM code to know how feasible this is)?

  • release:prepare runs, updating poms, removing -SNAPSHOT from versions, etc.
  • The release plugin checks in the updated poms. If there's an error (the working copy is out of date, say), notify the user to update and re-try release:prepare
  • The release plugin records the revision number of the commit
  • The release plugin tags (via a remote URL) the recorded trunk revision as the release
  • The release plugin updates the needed poms to new snapshot versions and checks them in.

I hope there's a fix for this soon; we're fine with SVN 1.4.x for now, but it would be much more convenient to be able to upgrade.


Kuno Baeriswyl added a comment - 11/Dec/08 02:43 AM

I've contacted the subversion developer list. Nobody of the subversion team seams to be aware of this problem...as a consequence, the issue won't get fixed...

Can anybody reproduce the problem with subversion? Or does anybody know exactly what does not work with subversion?

If so, please report it the topic in the developer list : http://www.nabble.com/Maven-scm-tag-does-not-work-with-Subversion-1.5.x-td20930592.html

THanks a lot. I hope we can fixed it this way.

Kuno


Brent Plump added a comment - 08/Jan/09 03:24 PM

The core subversion issue is tracked here: http://subversion.tigris.org/issues/show_bug.cgi?id=3119 Daniel Shahaf's comment (posted on December 31) links to a good summary of the issue.

Unless the release/scm plugins implement a workaround, we'll need to wait for this issue to be fixed by the svn team.

In the meantime, I am using svn 1.5.0 for release actions and the current version for the rest of my work.


Dan Tran added a comment - 12/Jan/09 12:42 AM

From last view comments, the fix will be at SVN side. The bug will be moved out of 1.1.1 release and probably will not get fixed since we do have work around


Martin Nilsson added a comment - 22/Jan/09 03:48 AM

I have experienced the same problem, but after changing the protocol from http to svn (i.e. using svnserve instead of apache) I managed to release without the error.

I'm using svn 1.5.5


Justin Edelson added a comment - 25/Feb/09 09:17 AM

Has anyone tested this against Subversion 1.6 RC2?


Johan van Ee added a comment - 03/Mar/09 02:31 AM

Is there any news when this bug will be fixed in subversion?


Stephen Connolly added a comment - 14/Mar/09 01:48 PM

There are some reports I saw a month back on the subversion mailing list that this is an issue with the neon transport. If you use the serf transport the problem goes away.

AFAIK the situation is as follows:

svn:// always works
svn+ssh:// always works
http:// only works with serf (I have not confirmed this yet)
https:// only works with serf (I have not confirmed this yet)


Olivier Lamy made changes - 15/Mar/09 12:43 PM
Assignee Olivier Lamy [ olamy ]
Olivier Lamy added a comment - 15/Mar/09 12:47 PM

see proposals added in SCM-262. This will need some changes in release plugin/manager too as the proposal won't be activated by default in order to preserve backward compatibility.
I hope I will find some friends to test the "fix" (I prefer to call this a workaround to a svn issue !)


Olivier Lamy made changes - 16/Mar/09 07:25 PM
Link This issue relates to MRELEASE-427 [ MRELEASE-427 ]
Olivier Lamy added a comment - 16/Mar/09 07:30 PM

So I close this issue because it's now possible to tag remotely with the svnexe provider.
Concerning issue with the release plugin, have a look at MRELEASE-427.


Olivier Lamy made changes - 16/Mar/09 07:30 PM
Resolution Fixed [ 1 ]
Status Open [ 1 ] Closed [ 6 ]
Stefan Sperling added a comment - 10/Sep/09 04:58 AM

The underlying problem in Subversion has been fixed in 1.6.5.
See http://subversion.tigris.org/issues/show_bug.cgi?id=3119
and the 1.6.5 entry in http://svn.collab.net/repos/svn/trunk/CHANGES

Maybe the plugin should limit use of its workaround to affected versions only?