bat调用ant后继续执行之后的命令

用Windows的批处理bat调用ant,ant执行完后后面的命令无法执行,直接退出。

例如:
@echo off
setlocal enabledelayedexpansion

set BUILD_PATH="%cd%/build"
set DIST_PATH="%cd%/dest"

if exist %BUILD_PATH% (rd /q /s %BUILD_PATH%)
md %BUILD_PATH%

if exist %DIST_PATH% (rd /q/s %DIST_PATH%)
md %DIST_PATH%

java -jar xx.jar
[color=red]ant -f build_xx.xml -propertyfile xx.properties[/color]

echo Removing temp files.......
if exist %BUILD_PATH% (rd /q/s %BUILD_PATH%)
echo Temp files are removed.

echo You can find the result in %cd%\dist folder!!

只需要调用ant命令前加上call即可解决该问题
[color=blue]call ant -f build_xx.xml -propertyfile xx.properties[/color]

你可能感兴趣的:(java)