Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set version with versions-maven-plugin in interactive mode with M2Eclipse plug-in?

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.
like image 786
dur Avatar asked Dec 01 '15 14:12

dur


1 Answers

I found a work-around, see How to make Eclipse prompt me for command line arguments.

I have to define system property like this

-DnewVersion=${string_prompt:new version}

and after starting the launch configuration in Eclipse, I get a dialog to enter the new version. Then versions-maven-plugin uses the version from dialog.

like image 100
dur Avatar answered Oct 11 '22 13:10

dur