Here is what I have that work with windows
<target name="forknewant">
<property name="ant.dir" value="${basedir}/apache-ant-1.8.2" />
<exec executable="cmd" dir="${project.loc}">
<arg value="/K" />
<arg value="start" />
<arg value=""${project.title}"" />
<arg line="cmd.exe /k ant" />
<arg value="-Dtest.haltonfailure=no" />
<env key="CLASSPATH" value="" />
<env key="ANT_HOME" value="${ant.dir}" />
<env key="PATH" value="${ant.dir}/bin;${java.home}/bin" />
</exec>
</target>
Requirement for this code is to fork a new build, parent build doesn’t wait and console output is displayed.
I know this work for windows but I am looking for cross platform way of doing it.
You might be able to achieve what you want with the
anttask which runs one Ant script from another. Something like this:However, the parent build file will wait for this task to complete before it proceeds.
You can consider using the
paralleltask to run several things in parallel. Depending on exactly what it is you want to do, this might solve your problem. Be sure to read the warnings about concurrency in the documentation forparallel.parallelwill wait until all tasks it runs are completed. However, you can use thedaemonstag to avoid that. So the closest thing to what you ask for would be:This wil run the Ant build file in
${project.loc}, not waiting for it to finish. There is one important caveat however: if the main build file finishes first, it will kill the process of the spawned build. This is all explained in theparalleldoc.