anttaskdef

does the tasks defined by taskdef will run fork mode or inside same process by default in ant?


As there is no fork attribute for taskdef, so by default, does the tasks defined by taskdef will run fork mode or inside same process where ant script runs.

My task is defined as below

<taskdef name="test" classname="com.org.test.test1" loaderref="test.classloader" />

Thanks In Advance, Soman


Solution

  • No. It's in the same process.

    For the most easy way to prove that, you just run a simple Ant build file with some simple targets and custom tasks, and use a process manager to check if the Ant process creates any new process.

    If you want something to be executed in a forked process, you should do it by yourself in your task's Java code. Some tasks (like junit or java) have the fork-related parameter -- it's done by the tasks themselves, not by Ant.