If we were to split the version string into components on - and . and _ and 
also split on transitions from number to letters then use the ordering rules 
at each component as defined here...

Examples of version to components split
1.0 ==> 1, 0
1.0-beta1 ==> 1, 0, beta, 1
1-SNAPSHOT ==> 1, SNAPSHOT
2.3.4.5-r1 ==> 2, 3, 4, 5, r, 1

So each component could try a numeric compare if parsing as Integer works or 
string comparison otherwise.

essentially this rule is applied to all components
SNAPSHOT < ALPHA < BETA < RC < "" < [a-zA-Z]* < [0-9]*

With exceptions for SNAPSHOT, BETA, ALPHA which can have special meaning and 
be less than anything in order. And the absense of an entry puts it above 

Its very similar to how things work now
<http://docs.codehaus.org/display/MAVEN/Dependency+Mediation+and+Conflict+Resolution>

This would seem to give a common sense interpretation of all versions

This algorithm will work for
./commons-collections/commons-collections/2.0
./commons-collections/commons-collections/2.1
./commons-collections/commons-collections/3.0
./commons-collections/commons-collections/3.1
./commons-collections/commons-collections/3.2
./commons-collections/commons-collections/2.1.1

./commons-httpclient/commons-httpclient
./commons-httpclient/commons-httpclient/3.1
./commons-httpclient/commons-httpclient/2.0.2
./commons-httpclient/commons-httpclient/3.0.1
./commons-httpclient/commons-httpclient/3.1-rc1

./jaxen/jaxen/1.1.1
./jaxen/jaxen/1.1-beta-6
./jaxen/jaxen/1.1-beta-8
./jaxen/jaxen/1.1-beta-9
./jaxen/jaxen/1.0-FCS

./commons-io/commons-io
./commons-io/commons-io/1.2
./commons-io/commons-io/1.3
./commons-io/commons-io/1.4
./commons-io/commons-io/1.3.1

./geronimo-spec/geronimo-spec-jta/1.0-M1/    
./geronimo-spec/geronimo-spec-jta/1.0.1B-rc1/                        
./geronimo-spec/geronimo-spec-jta/1.0.1B-rc2/                        
./geronimo-spec/geronimo-spec-jta/1.0.1B-rc3/                        
./geronimo-spec/geronimo-spec-jta/1.0.1B-rc4/   

./info/magnolia/magnolia-core/3.5.4
./info/magnolia/magnolia-core/3.6-SNAPSHOT
./info/magnolia/magnolia-core/3.5.4.1-SNAPSHOT

./poi/poi/2.5.1
./poi/poi/2.5.1-final-20040804

./org/hibernate/hibernate/3.0.5
./org/hibernate/hibernate/3.2.0.ga
./org/hibernate/hibernate/3.2.3.ga
./org/hibernate/hibernate/3.2.5.ga
./org/hibernate/hibernate/3.2.0.cr5
./org/hibernate/hibernate-tools
./org/hibernate/hibernate-tools/3.2.0.beta9a
./org/hibernate/hibernate-annotations
./org/hibernate/hibernate-annotations/3.2.0.ga

the .beta1 vs -beta1 example

./org/mortbay/jetty/servlet-api-2.5/6.1.3
./org/mortbay/jetty/servlet-api-2.5/6.1.5
./org/mortbay/jetty/servlet-api-2.5/6.0.0beta12
./org/mortbay/jetty/servlet-api-2.5/6.1.1rc1

and even my favourite bug bear
./cglib/cglib/1.0/                    
./cglib/cglib/2.0-rc2/             
./cglib/cglib/2.0.1/                   
./cglib/cglib/2.0.2/                  
./cglib/cglib/2.0beta2/              
./cglib/cglib/2.1/                     
./cglib/cglib/2.1_2/                    
./cglib/cglib/2.1_3/                  
./cglib/cglib/rc2-1.0/ 

--
Michael McCallum
Enterprise Engineer
mailto:[EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to