I’ve put together an example Maven project demonstrating how to generate build information at compile time without any external plugins.
Motivation #
The solution originates from frustration generating build information - including artifact name, version, latest commit ID and build date - with Maven versions as old as 3.3.9.
Solution #
This solution involves solely additions to an existing pom.xml, adding and
configuring commonly-available plugins maven-antrun-plugin and
build-helper-maven-plugin.
For details, check out the repository to see how it works and how to integrate the solution into an existing Maven project.
UPDATE v.0.0.2 for 2024-01-30 Made some minor improvements, shortening the number of lines to copy and paste.