Demonstrate an alternative way of fixing version numbers #3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi Jean,
Your blog post is great; it's been very useful to us recently.
I'd like to highlight a potential improvement to this, regarding where you work around the incorrectly numbered snapshot build issue.
Your code (adding the
bump
operation to thereleaseVersion
setting) fixes the version numbering around doing releases, which is great. But if I runsbt version
I'll still geta.b.c-SNAPSHOT
ifa.b.c
is the version that's most recently been released. According to Maven convention, the snapshot should have the numering for the next candidate release, e.g.a.b+1.c-SNAPSHOT
if you're using a minor bump strategy.Instead of overridding
releaseVersion
, the alternative approach we've taken is to tweak thegitTagToVersionNumber
logic to do the bumping in there for snapshot versions.This PR demonstrates the difference (no need to merge if you don't want to, it's just for information!); also you can see how we're using this in a real project we just open sourced (https://github.com/sky-uk/kafka-configurator/blob/master/project/Git.scala#L8-L17). That project also uses SBT 0.13.15 (at the time of writing) so it shows your ideas using the updated SBT conventions.
Hope this is interesting to you and useful to others.
Thanks
Olly