what you are discovering is that the ordering is not complete: it's not
intended to be a full "spec" that can compare anything
it's intended as a way to try to compare cases found in reality by people who
really chose a sequence of versions for their artifacts, without putting more
constraints
The spec also seems to not define the comparison output for when two tokens
have the same prefix, but one token is a qualifier, and the other is an
integer:
For such cases, the ComparableVersion code behaves oddly, in that it
outputs:
java -jar maven-artifact-3.5.3.jar 2 2.a
Display parameters as
Sorry, the 1-0-2 == 1-2 induced me to read the < as a >.
The code is buggy because it produces a canonical form & a comparison
result that are inconsistent.
The canonical form is consistent with the spec (as I read the spec; if you
read it otherwise, please let me know).
Everything should be con
no, current implementation result is 1-0-2 < 1-1
here is the proof:
$ java -jar maven-artifact-3.5.3.jar 1-0-2 1-1
Display parameters as parsed by Maven (in canonical form) and comparison result:
1. 1-0-2 == 1-2
1-0-2 < 1-1
2. 1-1 == 1-1
then explanations: who uses dashes (-) instead of dots
If you step through the algorithm from the spec, and if you run the main
method from ComparableVersion, you’ll see that the canonical form for 1-0-2
is indeed 1-2. There are places where the code deviates from the spec, for
which I’ve filed a bug report, but this is not one of them.
Does whoever i
IIRC only digits between dots are interpreted as numbers and will be
compared as numbers
With dashes values are concatenated as a String and hence will be compared
as Strings.
So dots and dashes have a different effect.
Here you can find a huge number of tests that should cover it:
https://ma
Sorry, I didn’t mean that the spec explicitly states an example that:
1-0-2 = 1-2 > 1-1
I meant that the algorithm described in the spec results in that outcome.
ComparableVersion correctly outputs that for the comparison between 1-0-2 &
1-1.
Both my original & my revised proposed change to the
On Thu, 31 May 2018 16:22:18 +0200, Ross Goldberg
wrote:
The maven Maven version order spec (
https://maven.apache.org/pom.html#Version_Order_Specification) indicates
that :
1-0-2 is equivalent to 1-2, so 1-0-2 = 1-2 > 1-1.
I don't recognize this. Can you quote from that page?
Robert
T
I’m amending my proposal to be:
Then, starting from the end of the version string, the following trailing
"null" tokens are trimmed:
* “null” qualifier tokens ("", "final", "ga")
* 0 tokens, except for those that are sandwiched between two hyphens
with a numeric token immediately followi
The maven Maven version order spec (
https://maven.apache.org/pom.html#Version_Order_Specification) indicates
that :
1-0-2 is equivalent to 1-2, so 1-0-2 = 1-2 > 1-1.
That doesn't make much sense to me.
I think the following line from the spec should be revised from:
Then, starting from the end
10 matches
Mail list logo