使用maven-release-plugin和git-1.8.5

时间:2014-01-03 20:37:58

标签: git maven-release-plugin

当使用git-1.8.5,maven-release-plugin(使用版本2.4.2和2.3.2测试)和mvn(使用版本3.1.1和3.0.5测试)时,运行mvn release:preparemvn release:prepare-with-pom失败。

mvn release:prepare 无法创建它应该创建的提交:

  

[maven-release-plugin]为下一次开发迭代做准备   [maven-release-plugin]准备发布foo-1.0.0

mvn release:prepare-with-pom因git错误而失败:

[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] 

2 个答案:

答案 0 :(得分:9)

根据Mark Derricutt's solution,明确将maven-scm-provider-gitexe:1.8.1依赖项添加到maven-release-plugin:2.4.2插件:

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

背景:

答案 1 :(得分:5)

这似乎已在3月5日发布的maven-release-plugin 2.5版本中得到修复。