使用git发布maven的插件,如果在进程中推送了提交,则会出错

amo*_*fis 7 git release maven-3 maven maven-release-plugin

我们使用git repository和maven release插件.在第一个构建步骤中,我们将所有更改提取到本地存储库,然后在下一个中运行mvn release:prepare release:perform.release:prepare更新工作区,更新pom文件中的版本,在存储库中创建标记,运行所有测试,构建jar等.如果没问题,则将本地存储库更改推送到远程更改(更新后的poms和标记创建).

问题在于,当有人同时推动一些变化时,从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.
Run Code Online (Sandbox Code Playgroud)

有人有类似的问题吗?怎么解决?

Oli*_*amy 3

看看pushChanges

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-release-plugin</artifactId>
    <configuration>
        <pushChanges>false</pushChanges>
    </configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)

...然后再推