[MNG-7058] Dependency Version Requirement Specification conflicts with SemVer pre-release specification
- Dominant language
- Java
- Stars
- 5.3k
- Forks
- 3.1k
- Avg merge
- 20h 40m
- Merged PRs (30d)
- 275
Description
**[Marcono1234](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=marcono1234)** opened **[MNG-7058](https://issues.apache.org/jira/browse/MNG-7058?redirect=false)** and commented
Possibly related to MNG-6420 and MNGSITE-387
The Maven [Version Order Specification](https://maven.apache.org/pom.html#version-order-specification) says:
> Non-numeric ("qualifiers") tokens have the alphabetical order, except for the following tokens which come first in this order:
> "alpha" < "beta" < "milestone" < "rc" = "cr" < "snapshot" < "" = "final" = "ga" < "sp"
It appears the intention of the author was that no qualifier (`""`) as well as `"final"` and `"ga"` represent a _release_.
However, because due to this exception these qualifiers always come first it conflicts with [SemVer 1.0.0 §4](https://semver.org/spec/v1.0.0.html#spec-item-4) defining pre-releases:
> A pre-release version number MAY be denoted by appending an arbitrary string immediately following the patch version and a dash.
This can result in situations where a release would come before a pre-release.
Imagine someone calls their pre-releases _alpha_, _beta_ and _gamma_. Version _1.2.0-gamma_ is according to SemVer a pre-release, yet if a release _1.2.0_ (or _1.2.0-final_) is released, Maven considers the pre-release newer than the release:
```
java -jar .\maven-artifact-3.6.2.jar 1.2.0 1.2.0-gamma
```
```
1. 1.2.0 == 1.2
1.2.0 < 1.2.0-gamma
2. 1.2.0-gamma == 1.2-gamma
```
This could be solve by specifying that an empty string (`""`) = `"final"` = `"ga"` < `"sp"` always come after any other qualifier. However, that might be a breaking change.
---
No further details from [MNG-7058](https://issues.apache.org/jira/browse/MNG-7058?redirect=false)
Contributor guide
Assessment
This issue has not been assessed yet.