Maven发布插件与git,错误如果提交在进程中被推送 [英] Maven release plugin with git, error if commits are pushed during process

查看:134
本文介绍了Maven发布插件与git,错误如果提交在进程中被推送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们使用git存储库和maven发布插件。在第一个构建步骤中,我们将所有更改都提交到本地存储库,并在下一个步骤中运行 mvn release:prepare release:执行版本:准备更新工作区,在pom文件中更新版本,在存储库中创建标签,运行所有测试,构建jar等。如果没问题,则会将本地存储库更改远程的(创建更新的poms和标签)。

问题是,当有人推动一些变化的同时,从maven推送失败。错误消息是:

 错误:无法将一些文件推送到'http://< my_repository>'
为防止您丢失历史记录,拒绝非快进更新
在再次推送前合并远程更改。有关详细信息,请参阅'git push --help'的'关于
快速转发的注意事项'部分。

有人有类似的问题吗?如何解决它?

解决方案

查看 pushChanges
$ b

 <插件> 
< groupId> org.apache.maven.plugins< / groupId>
< artifactId> maven-release-plugin< / artifactId>
<配置>
< pushChanges> false< / pushChanges>
< / configuration>
< / plugin>

...并稍后推送

We use git repository and maven release plugin. In the first build step, we pull all the changes to local repository, and in the next one we run mvn release:prepare release:perform. release:prepare updates workspace, updates version in pom files, creates tag in repository, runs all the tests, builds jars etc. If it's fine, it then pushes local repository changes to remote one (updated poms and tag created).

The problem is that when somebody pushes some changes meanwhile, push from maven fails. The error message is:

error: failed to push some refs to 'http://<my_repository>'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again.  See the 'Note about
fast-forwards' section of 'git push --help' for details.

Did somebody have similar problem? How to solve it?

解决方案

Have a look at pushChanges:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-release-plugin</artifactId>
    <configuration>
        <pushChanges>false</pushChanges>
    </configuration>
</plugin>

... and push later

这篇关于Maven发布插件与git,错误如果提交在进程中被推送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆