2015-12-01 19 views
3

我想在Eclipse中更改我的多模塊項目的版本versions-maven-plugin和目標versions:set。我使用M2Eclipse使用M2Eclipse插件以交互模式設置version-maven-plugin的版本?

我可以在啓動配置中設置-DnewVersion=0.0.2-SNAPTSHOT的新版本,它工作正常。但我想使用交互模式。

如果我不設置啓動配置-DnewVersion=0.0.2-SNAPTSHOT,我得到以下錯誤信息:

[ERROR] Failed to execute goal org.codehaus.mojo:versions-maven-plugin:2.2:set (default-cli) on project test-parent: You must specify the new version, either by using the newVersion property (that is -DnewVersion=... on the command line) or run in interactive mode -> [Help 1] 

Maven Settings Reference說:

  • interactiveModetrue如果Maven的應該嘗試互動與用戶輸入,如果不是,則爲false。默認爲true

回答

2

您不能使用Eclipse的交互模式運行爲> Maven Build ..配置。

我會建議使用Maven構建的控制檯,這是更可靠和更容易處理。

如果你不想離開你的IDE,可以運行Terminal通過右鍵點擊(其自帶默認爲最新版本)>秀>終端或安裝像EasyShell一個插件,這兩個選項將提供你的控制檯已經作爲你的Maven項目的工作目錄。

6

我找到了解決辦法,請參見How to make Eclipse prompt me for command line arguments

我必須定義系統屬性這樣

-DnewVersion=${string_prompt:new version} 

,並開始在Eclipse啓動配置後,我得到一個對話框,以進入新版本。然後versions-maven-plugin使用對話框中的版本。