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

2

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.
Crossness answered 1/12, 2015 at 14:55 Comment(0)
T
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.

Troyes answered 1/12, 2015 at 15:4 Comment(1)
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.Asceticism
C
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.

Crossness answered 4/12, 2015 at 15:13 Comment(1)
This should be the accepted answer, works like a charm. Thanks for sharing!Dogwatch
T
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.

Troyes answered 1/12, 2015 at 15:4 Comment(1)
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.Asceticism

© 2022 - 2024 — McMap. All rights reserved.