简体   繁体   English

当我使用maven-release-plugin释放分支时,为什么它尝试从修订版0创建分支?

[英]When I use the maven-release-plugin to release a branch, why does it try to create the branch from revision 0?

I'm using the maven-release-plugin. 我正在使用maven-release-plugin。 I'm trying to release a branch and it's failing when it tries to execute this command: 我正在尝试释放一个分支,并且在尝试执行此命令时失败:

cmd.exe /X /C "svn --non-interactive copy --file C:\Users\USER~1\AppData\Local\Temp\maven-scm-711744598.commit --parents --revision 0 https://domain/svn/app/branches/2.4.8.x https://domain/svn/app/tags/App-2.4.8.1"

It gives this error: 它给出了这个错误:

svn: E195012: Unable to find repository location for 'https://domain/svn/app/branches/2.4.8.x' in revision 0

I think this is happening in the prepare goal because when it fails it says: 我认为这是在准备目标中发生的,因为如果失败,它会说:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5:prepare

I asked a svn expert about this, and he said: 我问了一个svn专家,他说:

wait, why is it trying to copy something from r0? 等待,为什么要尝试从r0复制内容? By definition there is nothing in r0. 根据定义,r0中没有任何内容。 r0 is always an empty repository, the first objects are added in r1. r0始终是一个空的存储库,第一个对象添加到r1中。 That's why it fails. 这就是为什么它失败了。 the question is why maven tried it. 问题是为什么Maven尝试过。 If you supply a revision argument to 'svn copy' then the branch / tag you create is based on the source from the revision you specify so the source has to exist in that revision (if you don't specify, you get HEAD, ie, the newest revision) ...and as for that, I know nothing about maven or its plugins 如果为“ svn copy”提供修订版本参数,则您创建的分支/标记将基于您指定的修订版本中的源,因此源必须存在于该修订版本中(如果未指定,则会得到HEAD,即,最新版本)...至此,我对maven或其插件一无所知

So why is maven trying to copy from revision 0? 那么为什么Maven试图从修订版0复制? This is the maven command I ran: 这是我运行的maven命令:

mvn --batch-mode release:prepare release:perform

And my root pom has the maven-release-plugin defined like this: 我的根pom具有如下定义的maven-release-plugin:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-release-plugin</artifactId>
            <version>2.5</version>
            <configuration>
                <autoVersionSubmodules>true</autoVersionSubmodules>
                <developmentVersion>2.4.8.2-SNAPSHOT</developmentVersion>
                <releaseVersion>2.4.8.1</releaseVersion>
                <branchBase>https://domain/svn/app/branches</branchBase>
                <tagBase>https://domain/svn/app/tags</tagBase>
            </configuration>
        </plugin>

Also, my scm tag looks like this: 另外,我的scm标签看起来像这样:

<scm>
    <connection>scm:svn:https://domain/svn/app/branches/2.4.8.x</connection>
</scm>

My svn version is 1.8.5 (r1542147) 我的svn版本是1.8.5(r1542147)

Just wanted to add this late answer for if anyone has the same problem and the solution in the comment doesn't work. 只是想添加此最新答案,以解决是否有人遇到相同问题并且注释中的解决方案不起作用的问题。
We had the same problem in a multi module application, only our parent POM had the SCM tag (which worked perfectly in our other applications). 在多模块应用程序中,我们遇到了相同的问题,只有父POM带有SCM标签(在其他应用程序中效果很好)。 We got the same error but could solve it by adding the corresponding SCM tag to each child POM. 我们遇到了相同的错误,但是可以通过向每个子POM中添加相应的SCM标签来解决。 We never found out why this was... 我们从来没有发现这是为什么...

I also had this problem. 我也有这个问题。 In the affected project I had a custom search and replace of some files during the validate phase and I wanted to check in the changes to Svn before tagging so I added a custom check-in action like this: 在受影响的项目中,我在验证阶段进行了自定义搜索并替换了一些文件,我想在标记之前检查对Svn所做的更改,因此添加了如下自定义检查操作:

        <plugin>
            <artifactId>maven-release-plugin</artifactId>
            <configuration>
                <preparationGoals>clean verify scm:checkin -Dmessage="perform release"</preparationGoals>
            </configuration>
        </plugin>

This had the consequences that when the release plugin tried to check in the changes in the pom file, there were no changes since they were already committed by the custom action. 结果是,当发布插件尝试检入pom文件中的更改时,由于自定义操作已经提交了更改,因此没有更改。 Thus causing this error. 从而导致此错误。

I added a "includes" file list to my custom scm:checkin which only included the files that I had been tampering with and this fixed the problem for me. 我在自定义scm:checkin中添加了一个“包含”文件列表,该列表仅包含我一直在篡改的文件,这为我解决了问题。

The resulting configuration looked like this: 产生的配置如下所示:

        <plugin>
            <artifactId>maven-release-plugin</artifactId>
            <configuration>
                <preparationGoals>clean verify scm:checkin -Dmessage="perform release" -Dincludes="TwogWebUtilsGrailsPlugin.groovy,plugin.xml" -DconnectionType="connection"</preparationGoals>
            </configuration>
        </plugin>

The reason for my custom replace action is because the project is a Grails plugin and I was following the guidelines in this blog post . 我执行自定义替换操作的原因是因为该项目是Grails插件,并且我遵循了此博客文章中的指南。

LATE EDIT: After upgrading to maven 3.2, this solution seems to break. 最新编辑:升级到maven 3.2后,此解决方案似乎无法使用。 I am back to where I started. 我回到了起点。

As I said as a comment above: 正如我在上面的评论中所说:

I cleaned up EVERYTHING and ran just release:prepare by itself and it succeeded without issue. 我清理了一切,然后运行了release:自己准备,它成功了,没有任何问题。 Perhaps this is a bug where running release:prepare and release:perform together will cause this 也许这是一起运行release:prepare和release:perform会导致此错误的错误。

I have not run into this issue since running these commands separately. 自从单独运行这些命令以来,我还没有遇到这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM