...
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 | Without SNAPSHOT | With
| |
---|---|---|---|---|---|---|---|---|---|
1 | = | 1 | | SNAPSHOT 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-SNAPSHOT | = | 1.0.0-SNAPSHOT | | | 1.0-SNAPSHOT | < = | 1.0.10-SNAPSHOT | | |
1.1-SNAPSHOT 0 | < | 1.2-SNAPSHOT | | 1.0.0-SNAPSHOT | < | 1.1-SNAPSHOT | | ||
1.1 | < | 1.2 | | 1.1-SNAPSHOT | < | 1.2.0-SNAPSHOT | | ||
1.0.0-alpha-1-SNAPSHOT | < | 1.0-SNAPSHOT 1 | | | 1.0.0-alpha-1-SNAPSHOT | < | 1.0-alpha1-2-SNAPSHOT | | |
1.0-alpha-1-SNAPSHOT 1.1 | < | 1.2.0-beta-1-SNAPSHOT | | 1.0-SNAPSHOT1-SNAPSHOT | < | 1.2.0-beta-1-SNAPSHOT | | ||
1.0-SNAPSHOTalpha-SNAPSHOT 1 | < | 1.0-SNAPSHOT | | 1.0-alpha-1-SNAPSHOT-SNAPSHOT | < | 1.0-alpha-1-SNAPSHOT | | | |
1.0-alpha-SNAPSHOT 1 | < | 1.0-1alpha-SNAPSHOT 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-0-SNAPSHOT 1 | < | 2.0.1 | | 2.0-1-SNAPSHOT | < | 2.0.1-SNAPSHOT | | ||
2.0.1-klm | < = | 2.0.1-SNAPSHOT lmn |
| 2.0.1-klm-SNAPSHOT | < | 2.0.1-1lmn-SNAPSHOT |
| ||
2.0.01-SNAPSHOT xyz | < | 2.0-.1-SNAPSHOT |
| 2.0.1-1xyz-SNAPSHOT | < | 2.0.1-SNAPSHOT | | | |
2.0.1-klm-SNAPSHOT | < | 2.0.1-lmn-SNAPSHOT 123 | | | 2.0.1-xyz-SNAPSHOT | < | 2.0.1-123-SNAPSHOT |
| |
2.0.1-SNAPSHOT xyz | < | 2.0.1-123-SNAPSHOT | | | 2.0.1-xyz-SNAPSHOT | < | 2.0.1-123-SNAPSHOT | |
Proposal
I'm proposing the following implementation: GenericArtifactVersion.java (unit test: GenericArtifactVersionTest.java)
...