Semantic Versioning for Eclipse Developers
Eclipse/OSGi has a strict versioning scheme consisting of 4 parts, separated by dots. This is well-known to Eclipse developers, and thus in the Eclipse/OSGi world the versioning problems are solved.
In the past few months references to the Semantic Versioning scheme became more and more frequent. It seems similar to the Eclipse versioning, but is not quite the same. Thus a small overview is in order. Here is a comparision of the version segments:
|Eclipse Versioning||Semantic Versioning|
Valid Eclipse versions are i.e.: 0.9.0, 188.8.131.5200202-R32, 2.0.0.beta-20100202-R32, 2.0.0
Valid Semantic versions are i.e.: 0.9.0+20100202.R32, 1.11.2-beta, 2.0.0-beta+20100202.R165, 2.0.0
The rules for incrementing the different version segments are more or less the same in both versioning schemes. These are the rules for Semantic Versioning:
- MAJOR version when you make incompatible API changes,
- MINOR version when you add functionality in a backwards-compatible manner, and
- PATCH version when you make backwards-compatible bug fixes.
The difference is the syntax with the qualifier/metadata information in the last segments of the versions. A qualifier is separated by a dot and can be almost any string. Compared to the qualifier, the prerelease ID and build metadata are separated by ‘-‘/’+’ and carry a bit more semantic information.
An Eclipse developer might view this as just another qualifier, but be aware that the specification of a prerelease ID and build metadata actually tells more about the contents of a version than just “any string”. You can let yourself inspire for choosing your qualifiers, but in the Eclipse world, you’ll always have the problem, that 2.0.0.beta > 2.0.0
The different separators make the versions syntactically incompatible.
About Semantic Versioning
The semantic versioning was proposed by Gravatar inventor and Github Cofounder Tom Preston-Werner. It is almost two years old, now in version 2.0.0, but got more public awareness only recently.
What about Maven?
Eclipse and Semantic Versioning carry semantics in their versioning scheme, by being quite specific about when and how to increment which version segments.
Maven acknowledges the importance of versions, but is interested in them only for technical dependency resolution. Maven gives no semantic advice, and obviously it has to remain quite tolerant when interpreting versions. Maven can interpret semantic versions as well as Eclipse versions.