How to create a branch from an SVN tag with Maven?

Suppose I noted the release version of our project under $SVNROOT/project/tags/1.0. Suppose now that I need to create a branch from this tag, mark it as SNAPSHOTand update the configuration scm.

I tried with the goal release:preparein this way:

$ svn co $SVNROOT/project/tags/1.0 project-1.0
$ cd project-1.0
$ mvn release:branch -DbranchName=project-1.0.X -DupdateBranchVersions=true -DupdateWorkingCopyVersions=false

But this fails, with an error message warning me that I do not have the right to pass to the path $SVNROOT/project/tags/1.0 project-1.0(which is absolutely true --- we do not allow commits to tags).

What am I doing wrong here, and why did Maven try to commit something to the tag?

Update

Just to clarify: I run this from the directory in which I checked the tag. The exact error I get is the following:

[INFO] Executing: /bin/sh -c cd xxx && svn --non-interactive commit --file /tmp/maven-scm-28755080.commit --targets /tmp/maven-scm-535803351230252749-targets
[INFO] Working directory: xxx
org.apache.maven.shared.release.scm.ReleaseScmCommandException: Unable to commit files
Provider message:
The svn command failed.
Command output:
svn: Commit failed (details follow):
svn: 'pre-commit' hook failed with error output:
you do not have the rights to access this file: xxx/tags/xxx. 


        at org.apache.maven.shared.release.phase.ScmCommitPhase.checkin(ScmCommitPhase.java:133)
        at org.apache.maven.shared.release.phase.ScmCommitPhase.execute(ScmCommitPhase.java:109)
        at org.apache.maven.shared.release.DefaultReleaseManager.branch(DefaultReleaseManager.java:379)
        at org.apache.maven.shared.release.DefaultReleaseManager.branch(DefaultReleaseManager.java:350)
        at org.apache.maven.plugins.release.BranchReleaseMojo.execute(BranchReleaseMojo.java:133)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:284)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
        at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:616)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Unable to commit files
Provider message:
The svn command failed.
Command output:
svn: Commit failed (details follow):
svn: 'pre-commit' hook failed with error output:
you do not have the rights to access this file: xxx/tags/xxx. 
+3
4

mvn release:branch?

:

, doco, , release:branch revision/tag, . (.. tags/<my_release_version>).

(branches/myapp-1.3.1) (tags/myapp-1.3):

mvn release:branch -DbranchName=myapp-1.3.1 -DupdateBranchVersions=true
-DupdateWorkingCopyVersions=false

-DupdateBranchVersions pom.xml, scm.
false, , -.
if true, , , , .

. :

, .
, URL- scm .

.

:

  • ( )
  • pom, url-commit pom
+4
mvn release:branch
   -DbranchName=${project.artifactId}_${project.version} 
   -Dusername=${username} 
   -Dpassword=${passwd} 
   -DupdateBranchVersions=true 
   -DupdateVersionsToSnapshot=true 
   -DremoteTagging=false 
   -DsuppressCommitBeforeBranch=true 
   -DupdateWorkingCopyVersions=false

-DautoVersionSubmodules =

Maven . 1.5.0-azuresupport-SNAPSHOT. autoVersionSubmodules true, Maven Release , , .

-DsuppressCommitBeforeBranch =

Maven Releases . , , , VCS / . , .

-DremoteTagging =

SVN . , false.

-DupdateBranchVersions =

-DupdateWorkingCopyVersions =

, , , . , ​​, .

-D http://startbigthinksmall.wordpress.com/2011/11/29/create-branches-with-maven-release-plugin-svn/

+2

, , :

POM , , POM - . , :

mvn release:branch -DbranchName=my-branch -DupdateBranchVersions=true -DupdateWorkingCopyVersions=false

: ,

, , "pre-commit" hook, . :

  • , hook
0
source

The actual problem is that the target release:branchcaptures tags that are unconscionable error . There is no workaround. Your prefix hook probably doesn't work because it is designed - possibly correctly - to prevent crashes inside the tag directory.

0
source

Source: https://habr.com/ru/post/1754570/


All Articles