Matt Sevrens
Matt Sevrens

Reputation: 121

Run batch command after ant build

I'm trying to create a batch file that automates an annoying build process. The key part that's tripping me up is when a command starts a process that takes over input from the keyboard.

Basically, I run something along the lines of ant -f build-rmi.xml rmiregistry, which builds and runs the rmiregistry. After this is completed i need to run another build, but I can't figure out how to launch another command after the ant build is finished executing

I don't have write access to any of the ant files.

Upvotes: 3

Views: 3367

Answers (2)

Luke
Luke

Reputation: 93

use command call , the batch script file will not stop after run ant command

 call ant 

Upvotes: 1

Pulak Agrawal
Pulak Agrawal

Reputation: 2481

  1. Create a new ANT build script run-both.xml
  2. Add an Import in run-both.xml to get the original script.
  3. Create a new target in run-both.xml, say "runbatch".Use ANT exec task to call the DOS command from this target
<project name="run-both" default="runbatch"> 
<import file="${path_to_rmi}/build-rmi.xml"/> 

<target name="runbatch" depends="rmiregistry">   
    <exec executable="cmd">
       <arg value="/c"/>
       <arg value="echo hello Matt"/>   
    </exec>
 </target>
</project>

On the command prompt

ant -f run-both.xml

Upvotes: 1

Related Questions