开发者

Running ant from a batch file: Later commands don't run

开发者 https://www.devze.com 2023-01-29 07:05 出处:网络
I have a batch file that runs ant and then copies one of the files that were pro开发者_如何学Cduced:

I have a batch file that runs ant and then copies one of the files that were pro开发者_如何学Cduced:

ant -Dproject.version=1.1.2 release published
copy /Y D:\dir1\MyJar.jar   D:\dir2\MyJar.jar

When I run the batch file, ant runs successfully, but the copy statement never happens, although it will work just fine if I type it in and hit Enter after the ant task has finished.

What is going on here?


I had the same problem once and the magic call did it.

In that batch file of yours try:

call ant -Dproject.version=1.1.2 release published
copy /Y D:\dir1\MyJar.jar   D:\dir2\MyJar.jar

Cannot tell you why it worked, though. Guess it's Microsoft logic.


When you call one batch file from another (which is not always clear) you're supposed to use CALL (or call), otherwise it works more like goto and doesn't return back to the caller. Is ant actually a batch file ant.bat? This should work then:

CALL ant -Dproject.version=1.1.2 release published
0

上一篇:

:下一篇

精彩评论

暂无评论...
验证码 换一张
取 消