org.apache.tools.ant.taskdefs
Class Javac

java.lang.Object
  |
  +--org.apache.tools.ant.Task
        |
        +--org.apache.tools.ant.taskdefs.MatchingTask
              |
              +--org.apache.tools.ant.taskdefs.Javac
Direct Known Subclasses:
CompileTask

public class Javac
extends MatchingTask

Task to compile Java source files. This task can take the following arguments:

Of these arguments, the sourcedir and destdir are required.

When this task executes, it will recursively scan the sourcedir and destdir looking for Java source files to compile. This task makes its compile decision based on timestamp. Any other file in the sourcedir will be copied to the destdir allowing support files to be located properly in the classpath.

Author:
James Davidson duncan@x180.com, Robin Green greenrd@hotmail.com

Inner classes inherited from class org.apache.tools.ant.taskdefs.MatchingTask
MatchingTask.NameEntry
 
Field Summary
protected  java.util.Vector compileList
           
protected  java.util.Hashtable filecopyList
           
 
Fields inherited from class org.apache.tools.ant.taskdefs.MatchingTask
excludeList, includeList, useDefaultExcludes
 
Fields inherited from class org.apache.tools.ant.Task
description, location, project, target
 
Constructor Summary
Javac()
           
 
Method Summary
 void execute()
          Executes the task.
protected  void scanDir(java.io.File srcDir, java.io.File destDir, java.lang.String[] files)
          Scans the directory looking for source files to be compiled and support files to be copied.
 void setBootclasspath(java.lang.String bootclasspath)
          Sets the bootclasspath that will be used to compile the classes against.
 void setClasspath(java.lang.String classpath)
          Set the classpath to be used for this compilation.
 void setDebug(java.lang.String debugString)
          Set the debug flag.
 void setDeprecation(java.lang.String deprecationString)
          Set the deprecation flag.
 void setDestdir(java.lang.String destDirName)
          Set the destination directory into which the Java source files should be compiled.
 void setExtdirs(java.lang.String extdirs)
          Sets the extension directories that will be used during the compilation.
 void setFiltering(java.lang.String filter)
          Set the filtering flag.
 void setOptimize(java.lang.String optimizeString)
          Set the optimize flag.
 void setSrcdir(java.lang.String srcDirName)
          Set the source dir to find the source Java files.
 void setTarget(java.lang.String target)
          Sets the target VM that the classes will be compiled for.
 
Methods inherited from class org.apache.tools.ant.taskdefs.MatchingTask
createExclude, createInclude, getDirectoryScanner, getProperty, setDefaultexcludes, setExcludes, setIgnore, setIncludes, setItems
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, init, setDescription, setLocation, setTarget
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

compileList

protected java.util.Vector compileList

filecopyList

protected java.util.Hashtable filecopyList
Constructor Detail

Javac

public Javac()
Method Detail

setSrcdir

public void setSrcdir(java.lang.String srcDirName)
Set the source dir to find the source Java files.

setDestdir

public void setDestdir(java.lang.String destDirName)
Set the destination directory into which the Java source files should be compiled.

setClasspath

public void setClasspath(java.lang.String classpath)
Set the classpath to be used for this compilation.

setBootclasspath

public void setBootclasspath(java.lang.String bootclasspath)
Sets the bootclasspath that will be used to compile the classes against.

setExtdirs

public void setExtdirs(java.lang.String extdirs)
Sets the extension directories that will be used during the compilation.

setDeprecation

public void setDeprecation(java.lang.String deprecationString)
Set the deprecation flag.

setDebug

public void setDebug(java.lang.String debugString)
Set the debug flag.

setOptimize

public void setOptimize(java.lang.String optimizeString)
Set the optimize flag.

setTarget

public void setTarget(java.lang.String target)
Sets the target VM that the classes will be compiled for. Valid strings are "1.1", "1.2", and "1.3".

setFiltering

public void setFiltering(java.lang.String filter)
Set the filtering flag.

execute

public void execute()
             throws BuildException
Executes the task.
Overrides:
execute in class Task

scanDir

protected void scanDir(java.io.File srcDir,
                       java.io.File destDir,
                       java.lang.String[] files)
Scans the directory looking for source files to be compiled and support files to be copied. The results are returned in the class variables compileList and filecopyList.


Copyright © 2000 Apache Software Foundation. All Rights Reserved.