Closed klu2 closed 5 months ago
Please also check my latest comment here https://github.com/ajoberstar/reckon/issues/189#issuecomment-1310077212
It seems that when it comes to details, Maven and Gradle also differ, so it may make sense to stick to the plain specification in this library - but it would probably be worth mentioning that neither Maven nor Gradle do so.
you might also like https://github.com/cloudflightio/semantic-versioning
Hello Klaus!
Sorry it took me this long to get back to you. And thank you for sharing your findings on the matter.
I believe it has to do with the fact that the Specification implies the pre-release versions are case-sensitive (semver/semver#176) and the libraries/tools that don't claim to adhere to the Specification, don't have to play by the rules :)
After taking another look at the issue, feels like there's not much to add really.
In summary, thanks to the scripts and examples provided by @klu2, it appears that neither of the 2 most popular build tools fully comply with SemVer when it comes to comparing versions. That's something to keep in mind.
On the other hand, Java SemVer strives to strictly follow the specification, according to which "identifiers with letters or hyphens are compared lexically in ASCII sort order" (SemVer 2.0.0, p.11), in a case-sensitive manner (semver/semver#176).
Consider the following Kotlin JUnit test, which sorts a couple of version numbers with 3 different libraries:
The Maven and Gradle classes return:
whereas Java Semver returns:
I didn't find anything about
-SNAPSHOT
handling in the Semver Specification but simply the fact that the official Maven and Gradle libraries are working differently here, seems problematic to me.We discovered this issue during discussing https://github.com/ajoberstar/reckon/issues/189.
Happy about your feedback