如何将Maven项目版本获取到Windows命令行或批处理文件?
对于Linux,也回答了同样的问题-如何将Maven项目版本获取到Windows命令行或批处理文件?,windows,maven,command-line,Windows,Maven,Command Line,对于Linux,也回答了同样的问题- 但是Windows呢?在命令行中为我工作: mvn -q --non-recursive "-Dexec.executable=cmd" "-Dexec.args=/C echo ${project.version}" "org.codehaus.mojo:exec-maven-plugin:1.3.1:exec" 在批处理文件中: for /f %%i in ('call mvn -q --non-recursive "-Dexec.executable
但是Windows呢?在命令行中为我工作:
mvn -q --non-recursive "-Dexec.executable=cmd" "-Dexec.args=/C echo ${project.version}" "org.codehaus.mojo:exec-maven-plugin:1.3.1:exec"
在批处理文件中:
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%
在命令行中为我工作:
mvn -q --non-recursive "-Dexec.executable=cmd" "-Dexec.args=/C echo ${project.version}" "org.codehaus.mojo:exec-maven-plugin:1.3.1:exec"
在批处理文件中:
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%
令人惊叹的!!谢谢你,它起作用了,这正是我需要的真棒!!谢谢你,它起作用了,这正是我需要的