PTJavac

Description

Compiles a source tree using the Poet ptjavac external compiler.

The ptjavac compiler compiles and enhances the Java source code for use with the Poet object oriented database (OODB).

The source and destination directory will be recursively scanned for Java source files to compile. Only Java files that have no corresponding class file or where the class file is older than the java file will be compiled.

The directory structure of the source tree should follow the package hierarchy.

It is possible to refine the set of files that are being compiled/copied. This can be done with the includes, includesfile, excludes, excludesfile and defaultexcludes attributes. With the includes or includesfile attribute you specify the files you want to have included by using patterns. The exclude or excludesfile attribute is used to specify the files you want to have excluded. This is also done with patterns. And finally with the defaultexcludes attribute, you can specify whether you want to use default exclusions or not. See the section on directory based tasks, on how the inclusion/exclusion of files works, and how to write patterns.

Parameters

Attribute Description Required
poetschemaargs Poet schema action arguments. Valid values are:
  • "-xu" - update existing schema
  • "-xc" - create new schema
  • "-xn" - no registration
Yes
poetconfigpath Poet configuration filename specification. Default is ptjavac.opt in the build root directory. No
srcdir location of the java files. Yes, unless nested <src> elements are present.
destdir location where to store the class files. No
includes comma separated list of patterns of files that must be included. All files are included when omitted. No
includesfile the name of a file. Each line of this file is taken to be an include pattern 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. Each line of this file is taken to be an exclude pattern No
defaultexcludes indicates whether default excludes should be used or not ("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 reference to a PATH defined elsewhere. No
bootclasspathref location of bootstrap class files, given as by reference to a PATH defined elsewhere. No
extdirs location of installed extensions. No
encoding encoding of source files. No
debug indicates whether there should be compiled with debug information ("off"). No
optimize indicates whether there should be compiled with optimization ("off"). No
deprecation indicates whether there should be compiled with deprecation information ("off"). No
target Generate class files for specific VM version, e.g. "1.1" or "1.2". No
verbose asks the compiler for verbose output. No

Parameters specified as nested elements

This task forms an implicit FileSet and supports all attributes of <fileset> (dir becomes srcdir) as well as the nested <include>, <exclude> and <patternset> elements.

src, classpath, bootclasspath and extdirs

PTJavac's srcdir, classpath, bootclasspath and extdirs attributes are PATH like structure and can also be set via nested src, classpath, bootclasspath and extdirs elements respectively.

Examples

  <ptjavac srcdir="${src}"
         poetschemaargs="-xc"
         poetconfigpath="${src.dir}/ptjavac.opt"
         destdir="${build}"
         classpath="xyz.jar"
         debug="on"
  />

compiles all .java files under the directory ${src}, stores the .class files in the directory ${build}, and creates the Poet schema and database files according to the options in the specified Poet configuration file. The classpath used contains xyz.jar, and debug information is on.

  <ptjavac srcdir="${src}"
         poetschemaargs="-xu"
         destdir="${build}"
         includes="mypackage/p1/**,mypackage/p2/**"
         excludes="mypackage/p1/testpackage/**"
         classpath="xyz.jar"
         debug="on"
  />

compiles .java files under the directory ${src}, updates the Poet schema and database files, and stores the class files in the directory ${build}. The classpath used contains xyz.jar, and debug information is on. Only files under mypackage/p1 and mypackage/p2 are used. Files in the mypackage/p1/testpackage directory are excluded form compilation and copy.

  <ptjavac srcdir="${src}:${src2}"
         poetschemaargs="-xu"
         destdir="${build}"
         includes="mypackage/p1/**,mypackage/p2/**"
         excludes="mypackage/p1/testpackage/**"
         classpath="xyz.jar"
         debug="on"
  />

is the same as the previous example with the addition of a second source path, defined by the propery src2. This can also be represented using nested elements as follows

  <ptjavac destdir="${build}"
         poetschemaargs="-xu"
         classpath="xyz.jar"
         debug="on">
    <src path="${src}" />
    <src path="${src2}" />
    <include name="mypackage/p1/**" />
    <include name="mypackage/p2/**" />
    <exclude name="mypackage/p1/testpackage/**" />
  </ptjavac>

Note: If you are using Ant on Windows and a new DOS-Window pops up for every use of an external compiler this may be a problem of the JDK you are using. This problem may occur with all JDK's < 1.2.