Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 633
Tobb Avatar asked Nov 30 '12 16:11

Tobb


2 Answers

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>
like image 95
HaveAGuess Avatar answered Oct 18 '22 23:10

HaveAGuess


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.

like image 25
Tobb Avatar answered Oct 19 '22 00:10

Tobb