Run multiple ant tasks on the same virtual machine
I am running a unit test using ant
<target name="test" depends="tomcatDeploy" description="Build and run tests">
<ant dir="${aDir}" target="test"/>
<ant dir="${bDir}" target="test"/>
<ant dir="${cDir}" target="test"/>
<ant dir="${dDir}/ExtFramework" target="test"/>
</target>
and I want to run them on the same VM - otherwise I get a lot of overhead when creating the jvm and recreating the statics, etc.
Is there a way to do this?
a source to share
I think the subant task is what you are looking for. Assuming that all of your subdirectories have a common parent, you can do something like the following:
<target name="test" depends="tomcatDeploy" description="Build and run tests">
<subant target="test">
<fileset dir="${parent}" includes="**/build.xml"/>
</subant>
</target>
EDIT
How do you conduct tests? If you are using a task junit
, do you have one fork="yes"
? If so, this will run the tests in a new virtual machine. Change this to fork="no"
to run the tests in the same virtual machine.
a source to share
<parallel threadCount='4'>
<ant target='TargetThatConsumesLotsOfCPUTimeAndMemory'>
<param name='file' value='one.txt'/>
</ant>
<ant target='TargetThatConsumesLotsOfCPUTimeAndMemory'>
<param name='file' value='two.txt'/>
</ant>
<ant target='TargetThatConsumesLotsOfCPUTimeAndMemory'>
<param name='file' value='three.txt'/>
</ant>
<!-- repeated about 40 times -->
</parallel>
http://www.java-tips.org/other-api-tips/ant/how-to-use-parallel-task.html
a source to share