Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

setting maven properties by using shell command

Tags:

maven

I would like to obtain a value from a bash shell command and set a property using this value. I am not sure setting the property is the way to go -- what I am trying to do is obtain a value from a shell command that is executed by Maven and to use this value to name the jar that is created.

More specifically, I would like to obtain using the git describe command the tag of a project and append this tag to the name of the jar.

I would like to do something like this within the pom:

tag = git describe . . . mv '$jarname'.jar '$jarname$tag'.jar

If I from the command line I execute

mvn jar:jar

I am not sure I can even affect the name of the resultant jar even if I had the git tag, so that is another question.

like image 515
Jeff Avatar asked Jul 30 '26 22:07

Jeff


1 Answers

I'm sure there are many other similar plugins out there, but you can use my exec-set-property plugin goal to set a Maven property using the output of a shell command.

like image 188
Archie Avatar answered Aug 03 '26 11:08

Archie



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!