简体   繁体   中英

Maven release fails due to git failure

I am trying to do a mvn release, but it fails due to problems with 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:

    <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:

[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! The git clone-command logged right before the error is happening does not contain a reference to this folder either..

Just to add to Tobb 's excellent original answer..
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:...". (The bug is described here: 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!)

So, added the fixed version of the jar to my local maven repo, the git clone-command contained a ':' again, and things started working :)

Edit: This bug is fixed in version 2.4 of the maven release plugin.

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/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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