使用M2Eclipse插件在交互模式下使用versions-maven-plugin设置版本?

时间:2015-12-01 14:55:18

标签: java eclipse maven versions-maven-plugin

我想在Eclipse中使用versions-maven-plugin和目标versions:set更改我的多模块项目的版本。我使用M2Eclipse

我可以在启动配置中使用-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说:

  
      
  • interactiveMode true如果Maven应该尝试与用户进行交互以进行输入,false如果没有。默认为true
  •   

2 个答案:

答案 0 :(得分:9)

我找到了解决办法,请参阅How to make Eclipse prompt me for command line arguments

我必须像这样定义系统属性

-DnewVersion=${string_prompt:new version}

在Eclipse中启动启动配置后,我得到一个对话框来输入新版本。然后versions-maven-plugin使用对话框中的版本。

答案 1 :(得分:2)

您不能使用Eclipse Run作为>的交互模式。 Maven Build ..配置。

我建议使用适用于Maven构建的控制台,它更可靠,更易于处理。

如果您不想离开IDE,可以通过右键单击>运行Terminal(默认情况下带有最新版本)。显示在>终端或安装像EasyShell这样的插件,这两个选项都将为您的控制台提供Maven项目的工作目录。