Using Custom Ant Tasks

You can create your own Ant tasks and use them in your build scripts. The Ant module supports two styles provided by Ant: with and without an explicit classpath.

With Explicit Classpath

This is generally to be recommended. You write your tasks and then include in the build file (or wherever you like) instructions to compile them (and maybe produce a JAR of them too). To use them, include the long form of taskdef which includes a classpath. Here is a simple example:
<project name="test" default="all" basedir=".">
    <target name="init">
        <javac srcdir="tasksource" destdir="tasksource"/>
        <jar jarfile="mytasks.jar" basedir="tasksource">
            <exclude name="**/*.java"/>
        </jar>
        <taskdef name="customtask" classname="com.mycom.MyCustomTask"
                 classpath="mytasks.jar"/>
    </target>
    <target name="all" depends="init">
        <customtask someparam="val"/>
    </target>
</project>
The advantage is that no special preparation is needed to begin using the script; it is entirely self-contained. You can develop the tasks inside the IDE too if you like, and the script will compile them for you automatically.

No Explicit Classpath

In this case there is no particular place, according to the script, where the custom tasks are stored. The classpath attribute is missing from the taskdef. In this case you need to add the tasks to your classpath before starting Ant on the command line.

Inside the IDE, it also works to start the IDE with the tasks in its classpath. But a much better idea is to just mount the filesystem containing the source code for your tasks in the IDE's Filesystems tab. You can use the IDE to interactively develop and compile the tasks; the Ant script will automatically look for task definitions in your filesystems every time it is run.

Implicit

One style is not yet supported by the module: defining tasks implicitly. Ant lets you add default task definitions to a special file that lets any script you use automatically pick up task definitions. This feature may be supported in the Ant module in the future.