-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't ask for version number when removing snapshot from version. #709
Comments
Makes sense, but I wonder: if somebody depended on the current behaviour, this requested change would break it for them. Perhaps a kind of a "force" switch (although this leads to creating more and more switches)? I'm inclined to simply going with the suggested change and waiting till someone shouts. Opinions? |
@garretwilson just FYI, you can disable the prompter by using -DinteractiveMode=false in your invocation |
I was really happy to read that there was a workaround. I got suspicious when it wasn't mentioned in the documentation. And then I actually tried it:
Did you actually try it? 😁 To reiterate the gist of this ticket: In any case, |
Gotcha. My test actually relies on it, but I did not set it via command line.
But what it does is - it disables the prompt and the maven target fails with an error message. So it will still break your jobs, but it won't hang them. If I had to use the current version, I'd probably use something to run versions:set conditionally, e.g. a test on the pom.xml if it matches a regex pattern. In any case, the PR is there waiting to be reviewed and merged. |
If I have a project using a
*-SNAPSHOT
version, the Versions Maven Pluginset
goal has aremoveSnapshot
option that removes the-SNAPSHOT
suffix (for when if I'm ready to release the final version, for example). I can call it from the command line like this, and it works pretty well. (See also https://stackoverflow.com/a/46036141.)I want
set
removeSnapshot
to be idempotent. In other words, just like I can callset foo=bar
again and again in some example database or key-value store, I expect to callset
removeSnapshot
again and again with no change in behavior.Unfortunately once I call
mvn versions:set -DremoveSnapshot -DgenerateBackupPoms=false
the second time (i.e. if the-SNAPSHOT
suffix has already been removed, it asks for a version number!This behavior breaks batch/script files that do pre-release activities if they are run again (after realizing that a dependency needs to be updated, or whatever). Moreover the behavior doesn't even make sense: if I ask the plugin to remove the
-SNAPSHOT
suffix, why perform extra actions if the-SNAPSHOT
suffix is missing? Rather the plugin should be performing fewer operations if the-SNAPSHOT
suffix is missing; it should simply do nothing at all.(Without looking at the code, it's easy to suppose that the
removeSnapshot
functionality might have been added after the mainversion:set
functionality was written, and inadvertently the developer let the logic fall back to the defaultversions:set
logic if in reality there is nothing at all that needs done.)Please remove the user interaction for
removeSnapshot
when the-SNAPSHOT
suffix is not present, or at least provide an option to make this functionality idempotent (although I can't imagine of any use cases where someone would want to be asked for the version—if they wanted to be asked, they would have left off theremoveSnapshot
parameter altogether).Based on the totality of circumstances, it would seem this behavior is a bug.
The text was updated successfully, but these errors were encountered: