There is the same question answered for Linux - How to get Maven project version to the bash command line
But what about Windows?
There is the same question answered for Linux - How to get Maven project version to the bash command line
But what about Windows?
Worked for me in command line:
mvn -q --non-recursive "-Dexec.executable=cmd" "-Dexec.args=/C echo ${project.version}" "org.codehaus.mojo:exec-maven-plugin:1.3.1:exec"
In a batch file:
for /f %%i in ('call mvn -q --non-recursive "-Dexec.executable=cmd" "-Dexec.args=/C echo ${project.version}" "org.codehaus.mojo:exec-maven-plugin:1.3.1:exec"') do set PVERSION=%%i
echo %PVERSION%