Reputation: 35276
Using maven, how do you make the generated build war file contain a build number based on Git commit id?
Given that the project is using
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
Upvotes: 0
Views: 1289
Reputation: 5855
I think the FAQ gives you what you need:
Since version 2.1.4 there is a switch to control if you want the plugin to expose the generated properties to your pom as well. This switch is set to false by default to ensure that properties of reactor builds can't be overwritten by accident. Thus if you need this feature set
<injectAllReactorProjects>true</injectAllReactorProjects>
inside the plugin's config.
You should then be able to use something like <finalName>my-app-${git.commit.id}</finalName>
Upvotes: 2