当使用 git-1.8.5、maven-release-plugin(使用版本 2.4.2 和 2.3.2 测试)和 mvn(使用版本 3.1.1 和 3.0.5 测试)时,运行mvn release:prepare
and mvn release:prepare-with-pom
fails.
mvn release:prepare
创建失败它应该创建的提交:
[maven-release-plugin] 为下一次开发迭代做准备
[maven-release-plugin] 准备发布 foo-1.0.0
and 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]
As per 马克·德里卡特的解决方案 http://maven.40175.n5.nabble.com/maven-release-plugin-oddity-no-git-commit-under-mvn-3-1-1-td5777947.html#a5777968,显式地将 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>
背景:
- git-1.8.5 对格式进行了重大更改
git status
,所以现在像 maven-release-plugin 这样的脚本应该使用瓷器选项git status --porcelain
代替git status
.
- 所以,罗伯特·斯科尔特 (Robert Scholte) 无法包含对maven-scm-provider-gitexe:1.8使用 maven-release-plugin:2.4.2 http://maven.40175.n5.nabble.com/maven-release-plugin-oddity-no-git-commit-under-mvn-3-1-1-tp5777947p5778044.html.
- git 的 Maven scm 提供程序包含修复程序以包括
--porcelain
标志与maven-scm-provider-gitexe:1.8.1 http://mvnrepository.com/artifact/org.apache.maven.scm/maven-scm-provider-gitexe/1.8.1,但 maven-release-plugin:2.4.2 尚未更新其对 maven-scm-provider-gitexe 的依赖项。看https://jira.codehaus.org/browse/SCM-686 https://jira.codehaus.org/browse/SCM-686了解更多信息。
- 尽管依赖项已过时,我们可以通过将依赖项显式添加到 1.8.1 来覆盖它,如上所示。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)