Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Put current git branch to project version

I want to put the current git branch into the version field in pom xml. I found some post in the internet suggesting to do something like:

<version>${scm.version}</version>

but this seems not to work with git. Are there any other solutions?

like image 577
markus Avatar asked Feb 04 '14 13:02

markus


1 Answers

Yes, use the git commit id plugin for maven

It's pretty straightforward. You can use it to get the git branch with

${git.branch}

So in your case it would go:

<version>${git.branch}</version>
like image 117
Arnaud Potier Avatar answered Sep 19 '22 15:09

Arnaud Potier