Maven release plugin with git, error if commits are pushed during process

不羁的心 提交于 2019-12-12 10:37:37

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/11736680/maven-release-plugin-with-git-error-if-commits-are-pushed-during-process

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!