我们使用 git 存储库和 Maven 发布插件。在第一个构建步骤中,我们将所有更改提取到本地存储库,然后在下一个构建步骤中运行mvn release:prepare release:perform
. release:prepare
更新工作区、更新 pom 文件中的版本、在存储库中创建标签、运行所有测试、构建 jar 等。如果没问题,它会将本地存储库更改推送到远程存储库(更新的 pom 并创建标签)。
问题是,当有人同时推送一些更改时,从 Maven 推送会失败。错误信息是:
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.
有人有类似的问题吗?怎么解决呢?
看一下推送更改 http://maven.apache.org/maven-release/maven-release-plugin/prepare-mojo.html#pushChanges:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<configuration>
<pushChanges>false</pushChanges>
</configuration>
</plugin>
...然后再推
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)