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, taskName, taskType
 
Constructor Summary
Javac()
           
 
Method Summary
 Path createBootclasspath()
          Maybe creates a nested classpath element.
 Path createClasspath()
          Maybe creates a nested classpath element.
 Path createExtdirs()
          Maybe creates a nested classpath element.
 Path createSrc()
          Create a nested
 void execute()
          Executes the task.
protected  void resetFileLists()
          Clear the list of files to be compiled and copied..
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(Path bootclasspath)
          Sets the bootclasspath that will be used to compile the classes against.
 void setClasspath(Path classpath)
          Set the classpath to be used for this compilation.
 void setDebug(boolean debug)
          Set the debug flag.
 void setDeprecation(boolean deprecation)
          Set the deprecation flag.
 void setDestdir(java.io.File destDir)
          Set the destination directory into which the Java source files should be compiled.
 void setExtdirs(Path extdirs)
          Sets the extension directories that will be used during the compilation.
 void setFiltering(boolean filter)
          Set the filtering flag.
 void setOptimize(boolean optimize)
          Set the optimize flag.
 void setSrcdir(Path srcDir)
          Set the source dirs 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, setExcludesfile, setIgnore, setIncludes, setIncludesfile, setItems
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getProject, getTaskName, init, log, log, setDescription, setLocation, setOwningTarget, setTaskName
 
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

createSrc

public Path createSrc()
Create a nested element for multiple source path support.
Returns:
a nexted src element.

setSrcdir

public void setSrcdir(Path srcDir)
Set the source dirs to find the source Java files.

setDestdir

public void setDestdir(java.io.File destDir)
Set the destination directory into which the Java source files should be compiled.

setClasspath

public void setClasspath(Path classpath)
Set the classpath to be used for this compilation.

createClasspath

public Path createClasspath()
Maybe creates a nested classpath element.

setBootclasspath

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

createBootclasspath

public Path createBootclasspath()
Maybe creates a nested classpath element.

setExtdirs

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

createExtdirs

public Path createExtdirs()
Maybe creates a nested classpath element.

setDeprecation

public void setDeprecation(boolean deprecation)
Set the deprecation flag.

setDebug

public void setDebug(boolean debug)
Set the debug flag.

setOptimize

public void setOptimize(boolean optimize)
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(boolean filter)
Set the filtering flag.

execute

public void execute()
             throws BuildException
Executes the task.
Overrides:
execute in class Task
Following copied from class: org.apache.tools.ant.Task
Throws:
BuildException - if someting goes wrong with the build

resetFileLists

protected void resetFileLists()
Clear the list of files to be compiled and copied..

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.