I'm trying to write a make
recipe to change the jar name from the package version to the git commit.
COMMIT := $(shell git log -1 --format=%h)
MVN_VERSION := $(shell mvn -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive exec:exec)
jar:
mvn package assembly:single
rename:
@echo $(MVN_VERSION)
@echo $(COMMIT)
mv target/myjar-$(MVN_VERSION).jar target/myjar-$(COMMIT).jar
I know that the respective shell commands work (maven from this answer) on their own in bash, but when I run, nothing gets stored in the variable.
> make rename
4cbee79
mv target/myjar-.jar target/myjar-4cbee79.jar
mv: rename target/myjar-.jar to target/myjar-4cbee79.jar: No such file or directory