Re: Why is version 2.0 NOT same as 2.0.0?
On Tue, Jun 16, 2009 at 09:15, Paul Benedict wrote: > It may seem strange that 2.0.0 is not the same as 2.0, but it's not > totally unstrange. It is a matter of precision. > > Did you know BigDecimal("2.00") does not equal BigDecimal("2.0")? > > The second situation can be rectified by a setting. Perhaps the first > (in Maven) should too. > > Paul I don't think this line of arguments applies here. **versions are not floating point numbers!** A version is generally treated as a tuple of integers, which are then lexicographically compared. That is: "2.0" -> (2, 0) "2.0.0" -> (2, 0, 0) "2.13.34" -> (2, 13, 34) But the real world is messy, which raises questions: (1) Does the tuple of integers have some maximal length ("precision") or is it effectively unbounded. -> in Maven's case it's bounded at length 3. [[I wish it were unbounded]] (2) How do we treat the "missing" places when comparing two tuples of differing length? -> Maven treats these places as 0 (zero) when comparing artifact versions. (2, 0) == (2, 0, 0) Otherwise, a normal lexicographical sort would yield: (2, 0) < (2, 0, 0), just as "park" < "parka". (3) Do we allow non-numeric parts in the version? -> Maven does allow a qualifier which is effectively compared as a string. (Followed by a dash and build number, except this is broken according to the docs and is parsed as part of the qualifier.) Effectively, it is as if maven sorts "2.0-qualifier" as if it were the tuple (2, 0, 0, "qualifier"). 2.0-qualifier -> ( (2, 0), "qualifier" ) -> (2, 0, 0, "qualifier") (4) How do we handle versions that don't have the expected syntax? -> Maven punts and considers such versions to be either always greater or always lesser than parseable versions. (I don't recall which). [[I wish Maven had chosen to be "opinionated" about the format of version numbers and mandated that they all be parseable. It is, after all, opinionated about a great many other things and sanity in versioning would seem be to central to the whole resolution magic it tries to do.]] // Ben - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Why is version 2.0 NOT same as 2.0.0?
It may seem strange that 2.0.0 is not the same as 2.0, but it's not totally unstrange. It is a matter of precision. Did you know BigDecimal("2.00") does not equal BigDecimal("2.0")? The second situation can be rectified by a setting. Perhaps the first (in Maven) should too. Paul - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Why is version 2.0 NOT same as 2.0.0?
I guess it is because the plugins are handled not by ArtifactVersion but by the DefaultPluginVersionManager. With regards, Nick Stolwijk ~Java Developer~ Iprofs BV. Claus Sluterweg 125 2012 WS Haarlem www.iprofs.nl On Sun, Jun 14, 2009 at 8:13 PM, B Smith-Mannschott wrote: >> 2009/6/14 B Smith-Mannschott : >>> On Sat, Jun 13, 2009 at 22:56, Jim Sellers wrote: I assume that maven treats them as Strings internally, not doubles. Just like version 3.0-RC1 and 1.0.3-beta3 are valid versions. >>> >>> Doubles!? How would you make a double out of 2.0.0? Nonsensical. >>> >>> http://www.sonatype.com/books/maven-book/reference/pom-relationships-sect-pom-syntax.html >>> >>> Maven version numbers generally have this form: >>> >>> ..- >>> >>> The version parts are treated as integers. Missing numeric parts are >>> considered zero. The qualifier is compared as a string. Any version >>> not following this syntax is treated purely as a string. >>> >>> I don't recall if unparseable versions always sort before or always >>> after parseable version numbers. It's been a while since I read the >>> code that actually takes care of this. It made me throw up a little >>> inside. >>> >>> // ben > > On Sun, Jun 14, 2009 at 19:25, Stephen > Connolly wrote: >> however 2.0 and 2.0.0 are both parseable versions. >> > > True, and they should be equivalent. Indeed the OP's second post > demonstrates this. So, whatever the explanation for the OP's issue, > it's not that parsing and comparision of versions is somehow > mysteriously broken. > > // ben > > - > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > > - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Why is version 2.0 NOT same as 2.0.0?
> 2009/6/14 B Smith-Mannschott : >> On Sat, Jun 13, 2009 at 22:56, Jim Sellers wrote: >>> I assume that maven treats them as Strings internally, not doubles. >>> >>> Just like version 3.0-RC1 and 1.0.3-beta3 are valid versions. >>> >> >> Doubles!? How would you make a double out of 2.0.0? Nonsensical. >> >> http://www.sonatype.com/books/maven-book/reference/pom-relationships-sect-pom-syntax.html >> >> Maven version numbers generally have this form: >> >> ..- >> >> The version parts are treated as integers. Missing numeric parts are >> considered zero. The qualifier is compared as a string. Any version >> not following this syntax is treated purely as a string. >> >> I don't recall if unparseable versions always sort before or always >> after parseable version numbers. It's been a while since I read the >> code that actually takes care of this. It made me throw up a little >> inside. >> >> // ben On Sun, Jun 14, 2009 at 19:25, Stephen Connolly wrote: > however 2.0 and 2.0.0 are both parseable versions. > True, and they should be equivalent. Indeed the OP's second post demonstrates this. So, whatever the explanation for the OP's issue, it's not that parsing and comparision of versions is somehow mysteriously broken. // ben - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Why is version 2.0 NOT same as 2.0.0?
however 2.0 and 2.0.0 are both parseable versions. 2009/6/14 B Smith-Mannschott : > On Sat, Jun 13, 2009 at 22:56, Jim Sellers wrote: >> I assume that maven treats them as Strings internally, not doubles. >> >> Just like version 3.0-RC1 and 1.0.3-beta3 are valid versions. >> > > Doubles!? How would you make a double out of 2.0.0? Nonsensical. > > http://www.sonatype.com/books/maven-book/reference/pom-relationships-sect-pom-syntax.html > > Maven version numbers generally have this form: > > ..- > > The version parts are treated as integers. Missing numeric parts are > considered zero. The qualifier is compared as a string. Any version > not following this syntax is treated purely as a string. > > I don't recall if unparseable versions always sort before or always > after parseable version numbers. It's been a while since I read the > code that actually takes care of this. It made me throw up a little > inside. > > // ben > > - > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > > - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Why is version 2.0 NOT same as 2.0.0?
On Sat, Jun 13, 2009 at 22:56, Jim Sellers wrote: > I assume that maven treats them as Strings internally, not doubles. > > Just like version 3.0-RC1 and 1.0.3-beta3 are valid versions. > Doubles!? How would you make a double out of 2.0.0? Nonsensical. http://www.sonatype.com/books/maven-book/reference/pom-relationships-sect-pom-syntax.html Maven version numbers generally have this form: ..- The version parts are treated as integers. Missing numeric parts are considered zero. The qualifier is compared as a string. Any version not following this syntax is treated purely as a string. I don't recall if unparseable versions always sort before or always after parseable version numbers. It's been a while since I read the code that actually takes care of this. It made me throw up a little inside. // ben - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Why is version 2.0 NOT same as 2.0.0?
Well, I wrote a simple program to compare the two versions and it reports 2.0 to be same as 2.0.0. // Main.java import org.apache.maven.artifact.versioning.DefaultArtifactVersion; class Main { public static void main(String... args) { if (args.length == 1) { DefaultArtifactVersion mv = new DefaultArtifactVersion(args[0]); System.out.println(mv.getMajorVersion() + ", " + mv.getMinorVersion() + ", " + mv.getIncrementalVersion() + ", " + mv.getQualifier()); } else { DefaultArtifactVersion mv1 = new DefaultArtifactVersion(args[0]); DefaultArtifactVersion mv2 = new DefaultArtifactVersion(args[1]); System.out.println(mv1.compareTo(mv2)); } } } Thanks, Sahoo Jim Sellers wrote: I assume that maven treats them as Strings internally, not doubles. Just like version 3.0-RC1 and 1.0.3-beta3 are valid versions. HTH Jim On Sat, Jun 13, 2009 at 11:17 AM, Sahoo wrote: It's quite annoying to see that some code path in maven (I am on version 2.0.9) does not think 2.0 is same as 2.0.0. I just tried to configure maven-bundle-plugin and specified the version as 2.0 and maven failed to locate the version. See error message below: /Reason: POM 'org.apache.felix:maven-bundle-plugin' not found in repository: Unable to download the artifact from any repository org.apache.felix:maven-bundle-plugin:pom:2.0 / As soon as I specified the version as 2.0.0, it found it. Strange, I must say. Thanks, Sahoo - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Why is version 2.0 NOT same as 2.0.0?
I assume that maven treats them as Strings internally, not doubles. Just like version 3.0-RC1 and 1.0.3-beta3 are valid versions. HTH Jim On Sat, Jun 13, 2009 at 11:17 AM, Sahoo wrote: > It's quite annoying to see that some code path in maven (I am on version > 2.0.9) does not think 2.0 is same as 2.0.0. I just tried to configure > maven-bundle-plugin and specified the version as 2.0 and maven failed to > locate the version. See error message below: > > /Reason: POM 'org.apache.felix:maven-bundle-plugin' not found in > repository: Unable to download the artifact from any repository > > org.apache.felix:maven-bundle-plugin:pom:2.0 > / > As soon as I specified the version as 2.0.0, it found it. Strange, I must > say. > > Thanks, > Sahoo > > - > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > >
Why is version 2.0 NOT same as 2.0.0?
It's quite annoying to see that some code path in maven (I am on version 2.0.9) does not think 2.0 is same as 2.0.0. I just tried to configure maven-bundle-plugin and specified the version as 2.0 and maven failed to locate the version. See error message below: /Reason: POM 'org.apache.felix:maven-bundle-plugin' not found in repository: Unable to download the artifact from any repository org.apache.felix:maven-bundle-plugin:pom:2.0 / As soon as I specified the version as 2.0.0, it found it. Strange, I must say. Thanks, Sahoo - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org