ajc
;
you can use it in place of the
Javac task.
The interface is like the Javac task interface, except it also accepts
parameters unique to ajc
:
nocomments, preprocess, workingdir, maxmemory, jvmarg, and argfiles.
An argument file is a file (usually <file>.lst) containing a list of source file
paths (absolute or relative to the argfile).
You can use it to specify all source files to be compiled, which ajc
requires
to avoid searching every possible source file in the source path when building aspects.
If you specify an argfile to the ajc task, it will not include all files in any specified
source directory (which is the default behavior for the Javac task when no includes are
specified). Conversely, if you specify excludes, they will be removed from the list of
files compiled even if they were specified in an argument file.
ajc
Attribute | Description | Required | |
srcdir | the base directory of the java files. (See note) | Yes, unless you use argfile or nested <src> elements. | |
destdir | Specify where to place the generated class files. | No | |
includes | comma-separated list of patterns of files that must be included; no files are included when omitted. | No | |
includesfile | the name of a file that contains include patterns. | No | |
excludes | comma-separated list of patterns of files that must be excluded; no files (except default excludes) are excluded when omitted. | No | |
excludesfile | the name of a file that contains exclude patterns. | No | |
defaultexcludes | whether default excludes should be used (yes | no); default excludes are used when omitted. | No | |
classpath | the classpath to use. | No | |
bootclasspath | location of bootstrap class files. | No | |
classpathref | the classpath to use, given as a reference to a PATH defined elsewhere. | No | |
bootclasspathref | location of bootstrap class files, given as a reference to a PATH defined elsewhere. | No | |
extdirs | location of installed extensions | No | |
debug | whether debug information should be included in classes output; defaults to false. | No | |
deprecation | whether compiler should emit messages about usage of deprecated API; defaults to false. | No | |
verbose | whether to emit compiler status messages during the compiler; defaults to false. | No | |
version | print ajc version and exit | No | |
failonerror | whether the build continues notwithstanding compile errors; defaults to true. | No | |
X | comma-delimited list of extended (-X...) options,
entered without -X
(e.g., X="lint,addSafePrefix" for
-Xlint -XaddSafePrefix ). |
No | |
source | Value of -source option - ignored unless "1.4" | No |
ajc
but
ignoredAttribute | Description | Required |
encoding | encoding of source files. | No |
optimize | whether source should be compiled with optimization | No |
target | generate class files for specific VM version (e.g., 1.1 or 1.2). | No |
depend | enables dependency-tracking | No |
includeAntRuntime | whether to include the Ant run-time libraries | No |
includeJavaRuntime | whether to include the run-time libraries from the executing VM | No |
threads | Multi-threaded compilation | No |
ajc
Attribute | Description | Required |
lenient | Interpret Java specification leniently, as do other compilers (defaults to off) | No |
strict | Interpret Java specification strictly (defaults to off) | No |
emacssym | Generate symbols for Emacs IDE support (defaults to off) | No |
porting | Only warn for some pre-1.0 language features to ease process of porting code. (defaults to off) | No |
nocomments | Used only in concert with usejavac or preprocess to not generate comments in output code. | No |
preprocess | if enabled, generate Java source files into <workingdir>. | No |
workingdir | Used only in concert with usejavac or preprocess to specify output directory; defaults to ajworkingdir. | No |
argfiles | a comma-delimited list of argfiles that contain a line-delimited list of source file paths (absolute or relative to the argfile) | No |
fork | if enabled, run the compile in another VM | No |
maxmemory | max amount of memory to allocate to the forked VM executing the compiler | No |
jvmarg | pass argument to the forked VM executing the compiler | No |
internalclasspath | classpath to add to system classpath when running compiler (forces fork) | No |
usejavac | if enabled, precompile sources and use javac to compile (tools.jar must be on the taskdef classpath); defaults to false. | No |
<ajc srcdir="${src}" destdir="${build}" argfiles="demo.lst" />compiles all .java files specified in the demo.lst and stores the .class files in the ${build} directory. Unlike the Javac task, the includes attribute is empty by default, so only those files specified in demo.lst are included.
This next example
<ajc srcdir="${src}" destdir="${build}" includes="spacewar/*,coordination/*" excludes="spacewar/Debug.java" />compiles .java files under the ${src} directory in the spacewar and coordination packages, and stores the .class files in the ${build} directory. All source files under spacewar/ and coordination/ are used, except Debug.java.
<ajc srcdir="${src}" destdir="${build}" argfiles="demo.lst" excludes="spacewar/Debug.java" />