Write A Batch File to Execute Several Ant Task

I am trying to write a dos batch file to execute several ANT tasks. But

it doesn't seem to work. The following is my code:

set WORK_HOME=c:\work
set PROJ_HOME=c:\work\proj

cd %WORK_HOME%\common
ANT

cd %PROJ_HOME%\common
ANT

As you can tell I want to execute ANT in %WORK_HOME%\common and then
execute another ANT in %PROJ_HOME%\common . It works fine after the
first ANT task. However, it stops after the execution completes. In
other words, it doesn't do "cd %ADONIS_HOME%\common".

Can anybody give a hand?

Thanks a lot !


Solution:
Use "Call Ant" instead of simply "ant"


Thanks to:
http://forum.java.sun.com/thread.jspa?threadID=540157&messageID=2617331

4 comments: (+add yours?)

Unknown said...

i too have the same problem...even Call ANT isn't working.
i want to run three ant commands
ANT Clean
then
ANT prepareJetty
..
.
.
first ant works fine,but its build success or build failed result doesn't show up

Unknown said...

i too have the same problem...even Call ANT isn't working.
i want to run three ant commands
ANT Clean
then
ANT prepareJetty
..
.
.
first ant works fine,but its build success or build failed result doesn't show up

Unknown said...

Are you using Windows or Linux? In Windows you need to add full path of ant.exe into the PATH, and then use call ant inside the batch file.
In Linux it's a different story then.

Jaxon Oakley said...

Ant task is the one thing that I have been wondering from the very first time about it. It sure seems to be great lesson to get from the one that you have been saying in this post.