Here's what I do:
- I commit and push something
- I go to Github and create a release-tag on the latest commit on master, say 0.0.1
Jenkins checks out branches /tags/
Checking out Revision a499.......0e (refs/tags/0.0.1)
Jgitver claims:
[echo] Jgitver variables:
[echo] jgitver.used_version: 0.0.1-SNAPSHOT
[echo] jgitver.calculated_version: 0.0.1-SNAPSHOT
[echo] jgitver.dirty: true
[echo] jgitver.git_sha1_full: a499.......50e
[echo] jgitver.branch_name:
[echo] jgitver.head_tags: 0.0.1
[echo] jgitver.head_annotated_tags:
[echo] jgitver.head_lightweight_tags: 0.0.1
[echo] jgitver.head_lightweight_tags: 0.0.1
[echo] jgitver.all_tags: 0.0.1
[echo] jgitver.all_annotated_tags:
[echo] jgitver.all_lightweight_tags: 0.0.1
[echo] gitver.all_version_tags: 0.0.1
[echo] jgitver.all_version_annotated_tags:
[echo] jgitver.all_version_lightweight_tags: 0.0.1
Jgitver config says:
<mavenLike>true</mavenLike>
<autoIncrementPatch>true</autoIncrementPatch>
<useCommitDistance>true</useCommitDistance>
<useDirty>false</useDirty>
<useGitCommitId>false</useGitCommitId>
<gitCommitIdLength>8</gitCommitIdLength>
<nonQualifierBranches>master</nonQualifierBranches>
<useDefaultBranchingPolicy>true</useDefaultBranchingPolicy>
Same happens on the master branch. It never seems to build a 0.0.1, it will always build a 0.0.1-SNAPSHOT.
I'm doing something wrong, but what is it?
Turns out "Releases" on Github-Enterprise are only lightweight Git tags.
Jgitver will always build SNAPSHOT versions from lightweight tags.
So in order to have Jenkins build a non-snapshot-version one needs to create an annotated tag manually.
You need to do the following: