Skip to content
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

version parameter is ignored on SNAPSHOT builds #52

Closed
elkman opened this issue May 19, 2021 · 4 comments · Fixed by #53
Closed

version parameter is ignored on SNAPSHOT builds #52

elkman opened this issue May 19, 2021 · 4 comments · Fixed by #53

Comments

@elkman
Copy link
Contributor

elkman commented May 19, 2021

Hi,

is there a good reason that in the case of a snapshot build, an explicitly defined version string via the <version> parameter is ignored?

In our case, the Maven version contains a hyphen (i.e. 2021-1.0.1-SNAPSHOT or 2021-1.0.1 for the release).
The extra hyphen confuses zypper and a snapshot RPM like foo-2021-1.0.1-0.202101020304.noarch.rpm cannot be removed via:
zypper remove foo -> Error: RPM failed: error: package foo-2021-1.0.1-0.202101020304.noarch is not installed.

So we use something like 2021_1.0.1 derived from the project version and use it with the <version> parameter tag for our release packages, but always have to remove the shapshot RPMs with rpm -e ... by hand.

I have already created a patch to try this out, but would need to adjust the tests to submit a PR.
Additionally, a new parameter could be introduced to switch between old and new behavior if needed.

Already thanks for feedback and all the great work that went into this plugin.

@ctron
Copy link
Owner

ctron commented May 20, 2021

Thanks for the report. I didn't use this plugin for a while, so I may have missed a point.

Taking a look at the documentation (good I did that 😁 ) there is the following behavior (or at least, there should be):

  • The parameter “release” has no effect for “-SNAPSHOT” versions. Unless the parameter forceRelease is set to true, in which case the build will always fall back to the Non-SNAPSHOT behavior and use the release field as it is.

So I guess, in your case, you should be able to use forceRelease=true to get in full control of the version.

@elkman
Copy link
Contributor Author

elkman commented May 26, 2021

Sorry for the late response and thank you for your feedback. You are right, the implementation correctly follows the documentation.

But it is quite tedious in Maven to set forceRelease=true and in case of a snapshot build to derive and set a valid <version> and depending on the build type always set a correct <release>. That was the reason for my thoughts to use <version> also for snapshots.

So another suggestion would be to introduce a <snapshotVersion> analogous to <snapshotReleasePrefix> and <snapshotBuildId>. At least for my case, this would make configuration relatively easy.

If that sounds like a good idea, I would create a pull request for it.

@ctron
Copy link
Owner

ctron commented May 26, 2021

Yes, that sounds like a good idea.

@elkman
Copy link
Contributor Author

elkman commented May 26, 2021

Ok, I will see when I find some time. First I have to go on vacation for the next two weeks.

@ctron ctron linked a pull request Jul 12, 2021 that will close this issue
@ctron ctron closed this as completed in #53 Jul 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants