6

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.
A_Di-Matteo
  • 26,902
  • 7
  • 94
  • 128
dur
  • 15,689
  • 25
  • 79
  • 125

2 Answers2

12

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.

Community
  • 1
  • 1
dur
  • 15,689
  • 25
  • 79
  • 125
2

You can't have an interactive mode with Eclipse Run as > Maven Build.. configuration.

I would suggest to use the console for Maven builds which is more reliable and easier to handle.

If you don't want to leave your IDE, you can run a Terminal (which comes by default with the latest versions) via right click > Show In > Terminal or install a plugin like the EasyShell, both options will provide your a console already having as working directory your Maven project.

A_Di-Matteo
  • 26,902
  • 7
  • 94
  • 128
  • Why can't you have an interactive mode? Under the runc configuration, there is an option in "common" to allocate a console, which says it's necessary for for input. – Raffi Khatchadourian Jun 13 '23 at 15:49