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

前端 未结 2 1544
礼貌的吻别
礼貌的吻别 2021-01-01 10:36

I have a batch file that runs ant and then copies one of the files that were produced:

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


        
相关标签:
2条回答
  • 2021-01-01 10:52

    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 讨论(0)
  • 2021-01-01 11:18

    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.

    0 讨论(0)
提交回复
热议问题