I was explaining a proposed build system (Gradle/Artifactory/Jenkins/Chef) to one of our senior architects, and he made a comment to me that I sort of disagree with, but am not experienced enough to really weigh-in on.
This project builds a Java library (JAR) as an artifact to be reused by other teams. For versioning, I'd like to use the semantic approach of:
<major>.<minor>.<patch>
Where patch
indicates bug/emergency fixes, minor
indicates backwards-compatible releases, and major
indicates either massive refactorings of the API and/or backwards-incompatible changes.
As far as delivery goes here is what I want: a developer commits some code; this triggers a build to a QA/TEST environment. Some tests are ran (some automated, some manual). If all tests pass, then a production build publishes the JAR to our in-house repo. By this point the JAR should be versioned properly, and my thinking was to use the build.number
that is automatically generated and provided by our CI tool to act as the patch number.
Thus, the versioning would actually be:
<major>.<minor>.<build.number>
Again, where build.number
is provided by the CI tool.
The architect dismissed this, saying that using the CI build number was an "abuse" of semantic versioning.
My question is: is this correct, and if so, why? And if not, why not?
Best Answer
Your build number won't be reset to 0, when minor and major versions increase, this violates sections 7 and 8 of the specs:
So, version numbers (major, minor, patch) must be provided manually, as these are used to tell your users about changes in one place without them having to look at your changelog or some other document.
If you want to include your build number, then you may append them after a
+
(section 10):