git version at runtime and packaging

Jan 13, 2022

I was not able to generate the at the beginning. somehow turns out it was due to a missing version for the plugin.

<plugin> <groupId>pl.project13.maven</groupId> <artifactId>git-commit-id-plugin</artifactId> <version>4.0.5</version> <!--need to add the specific version--> <executions> <execution> <goals> <goal>revision</goal> </goals> </execution> </executions> </plugin>

with that, at packaging, it could generate the package with the SHA.


the package name like ABC-1.0-7X7X40a-SNAPSHOT.jar

at runtime, with spring actuator enabled, it could auto pick up the commit info:


Originally published at on January 13, 2022.