2012-07-31 49 views
4

我們使用git存儲庫和maven發佈插件。在第一個構建步驟中,我們將所有更改提交到本地存儲庫,並在下一個步驟中運行mvn release:prepare release:performrelease:prepare更新工作區,更新pom文件中的版本,在資源庫中創建標記,運行所有測試,構建jar等。如果沒問題,它會將本地資源庫更改推送到遠程資源(更新的poms和創建的標記)。Maven發佈插件與git,如果提交過程中推進錯誤

問題是,當有人推動一些改變的同時,從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. 

有人有類似的問題嗎?如何解決它?

+0

*「更新[...]標籤」 * - 所以你要覆蓋一個標籤? – poke 2012-07-31 09:20:26

+0

否否,標籤僅被創建。我編輯了這個問題。對不起,不夠清楚。 – amorfis 2012-07-31 09:32:09

回答

3

看一看pushChanges

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

...後來推

+0

嗯...它解決了我的問題嗎?是的,Maven不會抱怨變化,但是如果有變化,並且我想推動,我需要首先'pull --rebase'並推動變化。然後,我最終發佈了代碼庫上的發佈標籤,這不是真的發佈,不是嗎? – amorfis 2012-08-02 09:02:53

+0

你會發布並標記你的本地版本。之後你可以合併。 – 2012-08-02 15:48:28