maven-git-versioning-extension icon indicating copy to clipboard operation
maven-git-versioning-extension copied to clipboard

Support valid semver versions

Open reitzmichnicht opened this issue 2 years ago • 4 comments
trafficstars

Hi

Best extension ever, but I stumpled upon some incompatibilities with some other ecosystems. We are using this extension to determine the version of maven projects from the branch name. Sadly its mostly not possible to restrict the branch naming itself, and we use the branch name as the prerelease part for semantic versioning. https://semver.org/spec/v2.0.0.html#backusnaur-form-grammar-for-valid-semver-versions

Semantic versioning fails if the branch name contains characters not allowed for the prerelease part. Maven itself does not care about it, but when reusing the same generated version for e.g. npm parts of the project it fails. So it would be great to have an option to make some variables compatible to be used as prerelease or build part of the semver string.

Kind regards, Michael

reitzmichnicht avatar Apr 03 '23 07:04 reitzmichnicht

Could you give some examples of invalid prerelease values?

qoomon avatar Apr 03 '23 08:04 qoomon

We are experiencing exactly the same problem (also with npm). For us the problem are underscores _ inside of the branch name (slug), npm will refuse these versions:

Version: {describe.tag.version}-${ref}.${describe.distance} feature/i_did_a_thing -> 1.0.0-feature-i_did_a_thing.99 should be 1.0.0-feature-i-did-a-thing.99

jstsddg avatar Jun 02 '23 09:06 jstsddg

Would it make sense to you to have an option to set the slug characters?

qoomon avatar Sep 28 '23 13:09 qoomon

Yes it would!

frans-otogone avatar Oct 16 '23 09:10 frans-otogone