I am using the "Merge before build" option of the git plugin to build a maven job. I have tried using ${GIT_BRANCH} and ${GIT_COMMIT} in my maven pom to write the commit information into my built artifacts but these variable are set to the branch being merged and its commit SHA-1.
Is there a way that I can find the SHA-1 of merged code and pass it into maven?
The Mojo's Buildnumber Maven Plugin can fetch this information for you.
The project site has not been fully updated to reflect the fact that it works with GIT.
That will set the
${buildNumber}
property to the full GIT hash of your workspace.It also will have the side-effect of ensuring that the build is the same on either a developers machine or the CI build server.