Question

When using git-1.8.5, with maven-release-plugin (tested with versions 2.4.2 and 2.3.2) with mvn (tested with versions 3.1.1 and 3.0.5), running mvn release:prepare and mvn release:prepare-with-pom fails.

mvn release:prepare fails to create the commits that it's supposed to create:

[maven-release-plugin] prepare for next development iteration
[maven-release-plugin] prepare release foo-1.0.0

and mvn release:prepare-with-pom fails with a git error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.4.2:prepare-with-pom (default-cli) on project foo: Cannot remove release POMs from SCM
[ERROR] Provider message:
[ERROR] The git command failed.
[ERROR] Command output:
[ERROR] error: the following file has changes staged in the index:
[ERROR] release-pom.xml
[ERROR] (use --cached to keep the file, or -f to force removal)
[ERROR] -> [Help 1]
[ERROR] 
Was it helpful?

Solution 2

This appears to have been fixed in version 2.5 of maven-release-plugin, which was released on March 5th.

OTHER TIPS

As per Mark Derricutt's solution, explicitly add the maven-scm-provider-gitexe:1.8.1 dependency to the maven-release-plugin:2.4.2 plugin:

<build>
   <plugins>
      <!-- ... -->
      <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-release-plugin</artifactId>
         <version>2.4.2</version>
         <dependencies>
            <dependency>
               <groupId>org.apache.maven.scm</groupId>
               <artifactId>maven-scm-provider-gitexe</artifactId>
               <!-- This version is necessary for use with git version 1.8.5 -->
               <version>1.8.1</version>
            </dependency>
         </dependencies>
      </plugin>
   </plugins>
</build>

Background:

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top