I was just reading the docs about “Version Ordering” here:
The examples in the following two points seem to be in conflict with eachother:
If both are not numeric, the parts are compared alphabetically, case-sensitive :
SNAPSHOT has no special meaning , and is sorted alphabetically like any other string part:
The docs don’t mention
alpha having any special meaning, so surely the uppercase
SNAPSHOT would be lower alphabetically than the lowercase
alpha? This seems to be in agreement with what I see on my project, where we have
nightly and we end up with
SNAPSHOT < nightly
I had the same question when they first released those docs. I asked about it somewhere, I think in the Gradle Slack community, but never heard back (or I did and have completely forgotten). What you are observing is correct, the version comparison ends up using the standard String.compareTo method for non-numeric parts with no special meaning.
Perhaps you can do a better job than I and raise an issue on Github
Thanks Chris, wanted to make sure at least someone agreed with me! I raised a PR, looks like Gradle 7 docs don’t have that bit any more since the default is the new ordering scheme Correct version ordering by wboult · Pull Request #16013 · gradle/gradle · GitHub
Thanks for raising this. That documentation is indeed wrong. I will take a look at the PR.