Chapter 4. AspectJ Ant Tasks

Table of Contents

Installing Ant Tasks
AjcTask (iajc)
AjcTask (iajc) Options
AjcTask matching parameters specified as nested elements
AjcTask Path-like Structures
Sample of iajc task
Avoiding clean compiles
Programmatically handling compiler messages
Ajc11CompilerAdapter (javac)
Sample of compiler adapter
Compiler adapter compilerarg options
Ajc10 (ajc)
Ajc10 (ajc) Options
Ajc10 parameters specified as nested elements
Sample of ajc task
Isolating problems running the Ant tasks
Known issues with the Ant tasks
Ant task questions and bugs


AspectJ contains a compiler, ajc, that can be run from Ant. Included in the aspectjtools.jar are Ant binaries to support three ways of running the compiler:

  1. AjcTask (iajc), a task to run the AspectJ post-1.1 compiler, which supports all the eclipse and ajc options, including incremental mode.

  2. Ajc11CompilerAdapter (javac), an adapter class to run the new compiler using Javac tasks by setting the build.compiler property

  3. Ajc10 (ajc), a task to run build scripts compatible with the AspectJ 1.0 tasks

This describes how to install and use the tasks and the adapter. For an example Ant script, see examples/build.xml.