Apparently, Ant doesn't allow you to run exec tasks
asynchronously. For example, if you start up Tomcat from an Ant build
file, it will wait until Tomcat exits before it continues to work
through its build file. This is probably not what you want it to
do. You probably want it to spawn Tomcat in a new process and keep on
trucking (or wait until Tomcat is up and then keep on trucking).
It seems to me this would be easy in Unix with a decent command
shell. However, I'm in Windoze. So, no luck there.
But, I found a great
thread (ala Google) that gives you a couple of options. I went
with the "antRunAsync" option. Worked like a charm! Here's my Tomcat
start target:
<target name="start.tomcat" depends="prepare" if="tomcat-needs-to-start">
<exec executable="cmd.exe" vmlauncher="false" failonerror="true">
<env key="PATH" path="C:/WINNT/system32;C:/WINNT;C:/Program Files/SQLLIB/BIN;C:/Program Files/SQLLIB/FUNCTION;C:/Program Files/SQLLIB/SAMPLES/REPL;C:/Program Files/SQLLIB/HELP;C:/PROGRA~1/IBM/IMNNQ"/>
<arg value="/c ${ant.home}/bin/antRunAsync ${websrv.dir}/bin/startup.bat"/>
</exec>
<waitfor>
<http url="${testurl}"/>
</waitfor>
</target>
5:32:43 PM
|