5

I want to change the version of my multi module project with versions-maven-plugin and goal versions:set in Eclipse. I use M2Eclipse.

I can set the new version with -DnewVersion=0.0.2-SNAPTSHOT in the launch configuration and it works fine. But I want to use the interactive mode.

If I don't set -DnewVersion=0.0.2-SNAPTSHOT in launch configuration, I get following error message:

[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 says:

  • interactiveMode: true if Maven should attempt to interact with the user for input, false if not. Defaults to true.
4

2 回答 2

12

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

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

-DnewVersion=${string_prompt:new version}

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

于 2015-12-04T15:13:46.700 回答
2

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

我建议将控制台用于更可靠且更易于处理的 Maven 构建。

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

于 2015-12-01T15:04:15.890 回答