gpt4 book ai didi

svn - 如何使用 Maven 从 SVN 标记创建分支?

转载 作者:行者123 更新时间:2023-12-04 19:32:05 24 4
gpt4 key购买 nike

假设我在 $SVNROOT/project/tags/1.0 下标记了我们项目的发布版本。假设现在我需要从该标记创建一个分支,将其标记为 SNAPSHOT,并更新 scm 配置。

我尝试了 release:prepare 目标:

$ 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

但这失败了,并出现一条错误消息警告我我没有提交到 $SVNROOT/project/tags/1.0 project-1.0 路径的权限(这是完全正确的——我们不允许提交到标签中)。

我在这里做错了什么,为什么 Maven 试图在标签中提交一些东西?

更新

澄清一下:我正在从 checkout 标签的目录中运行它。我得到的确切错误如下:

[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.

最佳答案

你在哪里执行那个命令 mvn release:branch

作为mentioned in this thread :

What the plugin doco does specify is that the release:branch goal should be invoked from a checkout location with the revision/tag you want to branch from. (i.e. tags/<my_release_version>).

I used the following commandline to create a maintenance branch (branches/myapp-1.3.1) from an existing tag location (tags/myapp-1.3):

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

The -DupdateBranchVersions flag pertains to the versions in the pom.xml - not the scm versions.
If false, it will retain the same version as the tagged release;
if true, it will prompt for a version, defaulting to a snapshot of the tagged release, which may or may not be what you want.

另见 this thread :

First you need to start with a working copy checked out from the Tag.
If the tag was created by the release plugin, the starting scm url should be correct, and point back to the tag.

Then use the plugin to crate the branch and switch the working copy to the branch.

An alternative is to manually:

  • copy from the tag to a new branch
  • switch the working copy to the new branch (or check out a working copy from the new branch)
  • update the pom to use the new branch's url- commit the update to the pom

关于svn - 如何使用 Maven 从 SVN 标记创建分支?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3244815/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com