To create a new Ant build file for an AspectJ project:
<?xml version="1.0" encoding="UTF-8"?>
<project name="My Project" default="build" basedir=".">
<target name="init" depends="init.variables,init.taskdefs" />
<target name="init.variables" description="init variables">
<property name="plugins.dir" location="${basedir}/../../plugins" />
<property name="aspectjrt.jar" location="${plugins.dir}/org.aspectj.runtime_1.5.0.20050610/aspectjrt.jar" />
<property name="ajde.jar" location="${plugins.dir}/org.aspectj.ajde_1.5.0.20050610/ajde.jar" />
</target>
<target name="init.taskdefs" depends="init.variables" unless="taskdefs.init">
<taskdef resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties">
<classpath>
<pathelement path="${ajde.jar}" />
</classpath>
</taskdef>
<property name="taskdefs.init" value="true" />
</target>
<target name="build" depends="init" description="build spacewar example">
<iajc destDir="${basedir}/bin" classpath="${aspectjrt.jar}" fork="true">
<forkclasspath>
<pathelement path="${plugins.dir}/org.eclipse.core.boot_3.0.0/boot.jar"/>
<pathelement path="${plugins.dir}/org.eclipse.core.resources_3.0.2/resources.jar"/>
<pathelement path="${plugins.dir}/org.eclipse.core.runtime_3.0.2/runtime.jar"/>
<pathelement path="${plugins.dir}/org.eclipse.core.runtime.compatibility_3.0.2/compatibility.jar"/>
<pathelement path="${plugins.dir}/org.apache.ant_1.6.2/lib/ant.jar"/>
<pathelement path="${ajde.jar}" />
</forkclasspath>
<srcdir>
<pathelement path="src/" />
</srcdir>
</iajc>
</target>
</project>
Please see the AspectJ language guide for more information on the iajc Ant task.
Using build configurations with Ant
Creating an Ant build file for an AspectJ plug-in