简体   繁体   English

由于git失败,Maven发布失败

[英]Maven release fails due to git failure

I am trying to do a mvn release, but it fails due to problems with git. 我正在尝试发布mvn,但由于git问题而失败。 I have done this multiple times before without this problem, and I really don't get why/how this is happening. 在没有这个问题之前我已经多次这样做了,我真的不知道为什么/如何发生这种情况。

I first got it doing mvn release:prepare, but got around it by adding the last line shown below to my root-pom: 我首先得到它做mvn release:prepare,但通过将下面显示的最后一行添加到我的root-pom来解决它:

    <artifactId>maven-release-plugin</artifactId>
    <configuration>
      <preparationGoals>clean install</preparationGoals>
      <pushChanges>false</pushChanges>

But now, when I try to do mvn release:perform, I get the error message again: 但是现在,当我尝试执行mvn release:perform时,我再次收到错误消息:

[INFO] Executing: cmd.exe /X /C "git clone file://C\Users\torbjornk\nfr\MyProject/ C:\Users\torbjornk\nfr\MyProject\target\checkout"
[INFO] Working directory: C:\Users\torbjornk\nfr\MyProject\target
[ERROR] The git-clone command failed.
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE  
[INFO] ------------------------------------------------------------------------
[INFO] Unable to checkout from SCM
Provider message:
The git-clone command failed.
Command output:
fatal: 'C:/Program Files (x86)/Git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

I do not get where it gets the idea that my git-installation-folder is supposed to be a git repository! 我不知道我的git-installation-folder应该是一个git存储库! The git clone-command logged right before the error is happening does not contain a reference to this folder either.. 在错误发生之前记录的git clone-command也不包含对此文件夹的引用。

Just to add to Tobb 's excellent original answer.. 只是为了补充Tobb的优秀原创答案..
I noticed that this has been fixed but had issues getting the new version to work.. You have to add it as a plugin (not project) dependency, eg. 我注意到这已经修复但是在使新版本工作时遇到了问题。你必须将它添加为插件(而不是项目)依赖项,例如。

<!-- Appengine deploy at end of mvn release:perform -->
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-release-plugin</artifactId>
    <version>2.2.2</version>
    <dependencies>
        <dependency>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-scm-plugin</artifactId>
            <version>1.8.1</version>
        </dependency>
    </dependencies>
</plugin>

Turned out that this was an error that had been encountered before. 原来这是以前遇到的错误。 This is due to a bug in maven-scm-provider-git, which causes the file-reference to a local repository for checkout to lose its ':' in "C:...". 这是由于maven-scm-provider-git中的一个错误导致对本地存储库的文件引用以便在“C:...”中丢失其“:”。 (The bug is described here: http://jira.codehaus.org/browse/SCM-662 ) (这里描述了这个bug: http//jira.codehaus.org/browse/SCM-662

We fixed this by copying a fixed version of the jar into the local maven repository, but I had recently cleared my local repository in order to see if our Nexus repo was behaving correctly, and thus got an unfixed version of the jar in my local repo (doh!) 我们通过将固定版本的jar复制到本地maven存储库来修复此问题,但我最近清除了我的本地存储库以查看我们的Nexus存储库是否正常运行,从而在我的本地存储库中获得了一个未固定版本的jar (DOH!)

So, added the fixed version of the jar to my local maven repo, the git clone-command contained a ':' again, and things started working :) 所以,将固定版本的jar添加到我的本地maven repo中,git clone-command再次包含一个':',并且事情开始工作了:)

Edit: This bug is fixed in version 2.4 of the maven release plugin. 编辑:此错误在maven发行版插件的2.4版本中得到修复。

Could it be a problem with 这可能是一个问题

file://C\Users\torbjornk\nfr\MyProject/

? Can't you just clone using the regular path? 你不能只使用常规路径克隆?

C:\Users\torbjornk\nfr\MyProject/

If not I think it should be: 如果不是,我认为它应该是:

file:///C:/Users/torbjornk/nfr/MyProject/

If that doesn't work try one of these: 如果这不起作用,请尝试以下方法之一:

file://localhost/c|/Users/torbjornk/nfr/MyProject/
file:///c|/Users/torbjornk/nfr/MyProject/
file://localhost/c:/Users/torbjornk/nfr/MyProject/

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

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