如何让 Maven 版本与 git 一起使用?
尝试发布时,我总是得到这样的信息:
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Unable to commit files
Provider message:
The git-commit command failed.
Command output:
“命令输出”没有任何内容。
是否有一些秘密配置技巧可以让 Maven 与 git 很好地配合?
Trying to release, I always get this:
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Unable to commit files
Provider message:
The git-commit command failed.
Command output:
There is nothing by "command output".
Is there some secret configuration trick to get maven to play nice with git?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我看到 git-commit 命令输出为空的唯一情况是 问题 556,其中提出了以下解决方案:
The only case I saw where the git-commit command output was empty was on issue 556, where the following solution was proposed:
就像另一个答案中所说的那样,恢复可以通过以下方式完成
,但由于这并不总是有效,因此解决方案是删除
release.properties
并运行(如果您将 git 存储库重置为运行发布插件之前的状态。)
您可能还需要删除发布插件所做的提交,
它通常会进行两次提交,要删除两者,请运行上述命令两次,或更改
~1
与~2
。要将 git 内容与 maven 内容解耦(以便 mvn 构建不会因 git 错误而中断,您可以将其添加到您的
pom.xml
中:将 Push-changes 设置为 false 可以让您控制git 自己推送(请记住,您还必须推送标签,
git push --tags
。Like it's being said in the other answer, restoring is done either by doing
but since this doesn't always work, so the solution would be to remove
release.properties
, and running(This is not necessary if you reset your git repostiory to the state prior to running the release plugin.)
You might also have to remove the commits made by the release plugin, with
It usually makes two commits, to remove both either run the above command twice, or change the
~1
with~2
.To decouple the git stuff from the maven stuff (so that the mvn build doesn't break upon a git error, you could add this to your
pom.xml
:Setting push-changes to false lets you control the git push yourself. (Remember that you also have to push tags,
git push --tags
.遇到完全相同的问题,这里的两种解决方案都不起作用,直到我从
mvn-3.0.4
升级到mvn 3.2.5
Had the exact same problem and both solutions here did not work, until I upgraded from
mvn-3.0.4
tomvn 3.2.5