The ajc command compiles AspectJ and Java language files, weaving aspects as necessary to produce .class files compliant with any Java VM (1.1 or later). To do bytecode weaving, it also accepts input classes or aspects in binary form.
The arguments after the options specify the source file(s) to compile. (Specify source classes using the -injars option, below.) Files may be listed directly on the command line, or listed in a file. The -argfile file and @file forms are equivalent, and are interpreted as meaning all the files listed in the specified file. Each line in these files should contain one option or filename. Comments, as in Java, start with // and extend to the end of the line.
NB: You must explicitly pass ajc all sources necessary for the compilation. When compiling source files containing aspects or pointcuts, be sure to include the source files for any types affected by the aspects or picked out by the pointcuts. (To exclude types from the scope affected by the aspect, change the corresponding pointcut or declaration.) This is necessary because, unlike javac, ajc does not search the sourcepath for classes. You may use the -sourceroots option to specify as source all the .aj and .java files in a set of directory trees.
Accept as source bytecode any .class files inside the specified .jar files. The output will include these classes, possibly as woven with any applicable aspects. JarList, like classpath, is a single argument containing a list of paths to jar files, delimited by the platform- specific classpath delimiter.
Weave binary aspects from JarList zip files into all sources. The aspects should have been output by the same version of the compiler. To run the output classes requires putting all the aspectpath entries on the run classpath. JarList, like classpath, is a single argument containing a list of paths to jar files, delimited by the platform- specific classpath delimiter.
The file is a line-delimited list of arguments. These arguments are inserted into the argument list.
Run the compiler continuously. After the initial compilation, the compiler will wait to recompile until it reads a newline from the standard input, and will quit when it reads a 'q'. It will only recompile necessary components, so a recompile should be much faster than doing a second compile. This requires -sourceroots.
Find and build all .java or .aj source files under any directory listed in DirPaths. DirPaths, like classpath, is a single argument containing a list of paths to directories, delimited by the platform- specific classpath delimiter. Required by -incremental.
Set default level for messages about potential programming mistakes in crosscutting code. {level} may be ignore, warning, or error. This overrides entries in org/aspectj/weaver/XlintDefault.properties from aspectjtools.jar, but does not override levels set using the -Xlintfile option.
Specify properties file to set levels for specific crosscutting messages. PropertyFile is a path to a Java .properties file that takes the same property names and values as org/aspectj/weaver/XlintDefault.properties from aspectjtools.jar, which it also overrides.
Specify where to find user class files. Path is a single argument containing a list of paths to zip files or directories, delimited by the platform-specific path delimiter.
Install Jakarta Ant 1.5.1: Please see the official Jakarta Ant website for more information and the 1.5.1 distribution. This release is source-compatible with Ant 1.3 and Ant 1.4, but the task sources must be compiled with those versions of the Ant libraries to be used under those versions of Ant. Sources are available under the Common Public License v. 1.0 at http://eclipse.org/aspectj.
In Ant, third-party tasks can be declared using a taskdef entry in the build script, to identify the name and classes. When declaring a task, include the aspectjtools.jar either in the taskdef classpath or in ${ANT_HOME}/lib where it will be added to the system class path by the ant script. You may specify the task script names directly, or use the "resource" attribute to specify the default names:
<taskdef
resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties">
The current resource file retains the name "ajc" for the Ajc10 task, and uses "iajc" for the AspectJ 1.1 task.
For more information on using Ant, please refer to Jakarta's documentation on integrating user-defined Ant tasks into builds.