...
The unit tests that are there to test comparison only check for a few cases with snapshots. When all tests
(version A < version B) are expanded to also test for SNAPSHOTs (version A-SNAPSHOT < version B-SNAPSHOT) a
lot of the tests fail.
Left | Op | Right |
| Left | Op | Right |
|
|
---|---|---|---|---|---|---|---|---|
1 | = | 1 |
| 1-SNAPSHOT | = | 1-SNAPSHOT |
|
|
1 | < | 2 |
| 1-SNAPSHOT | < | 2-SNAPSHOT |
|
|
1.5 | < | 2 |
| 1.5-SNAPSHOT | < | 2-SNAPSHOT |
|
|
1 | < | 2.5 |
| 1-SNAPSHOT | < | 2.5-SNAPSHOT |
|
|
1 | = | 1.0 |
| 1-SNAPSHOT | = | 1.0-SNAPSHOT |
|
|
1 | = | 1.0.0 |
| 1-SNAPSHOT | = | 1.0.0-SNAPSHOT |
|
|
1.0 | < | 1.1 |
| 1.0-SNAPSHOT | < | 1.1-SNAPSHOT |
|
|
1.1 | < | 1.2 |
| 1.1-SNAPSHOT | < | 1.2-SNAPSHOT |
|
|
1.0.0 | < | 1.1 |
| 1.0.0-SNAPSHOT | < | 1.1-SNAPSHOT |
|
|
1.1 | < | 1.2.0 |
| 1.1-SNAPSHOT | < | 1.2.0-SNAPSHOT |
|
|
1.0-alpha-1 | < | 1.0 |
| 1.0-alpha-1-SNAPSHOT | < | 1.0-SNAPSHOT |
|
|
1.0-alpha-1 | < | 1.0-alpha-2 |
| 1.0-alpha-1-SNAPSHOT | < | 1.0-alpha-2-SNAPSHOT |
|
|
1.0-alpha-1 | < | 1.0-beta-1 |
| 1.0-alpha-1-SNAPSHOT | < | 1.0-beta-1-SNAPSHOT |
|
|
1.0 | < | 1.0-1 |
| 1.0-SNAPSHOT | < | 1.0-1-SNAPSHOT |
|
|
1.0-1 | < | 1.0-2 |
| 1.0-1-SNAPSHOT | < | 1.0-2-SNAPSHOT |
|
|
2.0-0 | = | 2.0 |
| 2.0-0-SNAPSHOT | = | 2.0-SNAPSHOT |
|
|
2.0 | < | 2.0-1 |
| 2.0-SNAPSHOT | < | 2.0-1-SNAPSHOT |
|
|
2.0.0 | < | 2.0-1 |
| 2.0.0-SNAPSHOT | < | 2.0-1-SNAPSHOT |
|
|
2.0-1 | < | 2.0.1 |
| 2.0-1-SNAPSHOT | < | 2.0.1-SNAPSHOT |
|
|
2.0.1-klm | < | 2.0.1-lmn |
| 2.0.1-klm-SNAPSHOT | < | 2.0.1-lmn-SNAPSHOT |
|
|
2.0.1-xyz | < | 2.0.1 |
| 2.0.1-xyz-SNAPSHOT | < | 2.0.1-SNAPSHOT |
| notice that the proposal reverted the order : in Maven 2, 2.0.1-xyz < 2.0.1 but in Maven 3, 2.0.1 < 2.0.1-xyz |
2.0.1 | < | 2.0.1-123 |
| 2.0.1-SNAPSHOT | < | 2.0.1-123-SNAPSHOT |
|
|
2.0.1-xyz | < | 2.0.1-123 |
| 2.0.1-xyz-SNAPSHOT | < | 2.0.1-123-SNAPSHOT |
|
|
Proposal
I'm proposing the following implementation: GenericArtifactVersion.java (unit test: GenericArtifactVersionTest.java). It has been integrated in artifact 3.0-SNAPSHOT r656775(15/5/2008) as ComparableVersion.java.
...
Wiki Markup |
---|
<ac:structured-macro ac:name="anchor" ac:schema-version="1" ac:macro-id="bbc6c256a33df696-e29f5390-46a34380-afc185de-f63cb2b0827bc60cb92ceafb"><ac:parameter ac:name="">osgi</ac:parameter></ac:structured-macro> \[0\] [OSGi Service Platform Release 4 Version 4.1 Core Specification|http://www.osgi.org/Release4/Download], §3.2.4 "Version" and §3.2.5 "Version Ranges" on page 38, §3.5.3 "Bundle-Version" on page 46, §6.1.26.5 "Version.compareTo()" on page 200 |