I'll try to keep this question short and simple:
with the jgitver maven plugin I can easily create versions from Git tags. The ${jgitver.calculated_version} variable that I can use in my .pom file will, by default, behave like this:
- set Git tag "v1.0.0"
version: 1.0.0 - do Git commit
version: 1.0.1-SNAPSHOT
Is it possible to (and if so how can I) include the commit hash in the version number, like so?
- set Git tag "v1.0.0"
version: 1.0.0-162ad57 - do Git commit
version: 1.0.1-ff8cb8a-SNAPSHOT
The important part is that version numbers from simple (not tagged) commits also end with "SNAPSHOT".
Yes it is possible.
in the
.mvn/jgitver.config.xml
file set the propertyuseGitCommitId
to true. You can also define the expected length of the SHA1 usinggitCommitIdLength
something like: