|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.apache.tools.ant.taskdefs.MatchingTask
org.apache.tools.ant.taskdefs.Javac
org.springframework.build.ant.Javac
public class Javac
Compiles Java source files. This task can take the following arguments:
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.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.apache.tools.ant.taskdefs.Javac |
---|
org.apache.tools.ant.taskdefs.Javac.ImplementationSpecificArgument |
Field Summary | |
---|---|
private org.apache.tools.ant.types.Path |
bootclasspath
|
private static java.lang.String |
CLASSIC
|
private org.apache.tools.ant.types.Path |
compileClasspath
|
protected java.io.File[] |
compileList
|
private org.apache.tools.ant.types.Path |
compileSourcepath
|
private boolean |
debug
|
private java.lang.String |
debugLevel
|
private boolean |
depend
|
private boolean |
deprecation
|
private java.io.File |
destDir
|
private java.lang.String |
encoding
|
private org.apache.tools.ant.types.Path |
extdirs
|
private static java.lang.String |
EXTJAVAC
|
private org.apache.tools.ant.util.facade.FacadeTaskHelper |
facade
|
private static java.lang.String |
FAIL_MSG
|
protected boolean |
failOnError
|
private boolean |
fork
|
private java.lang.String |
forkedExecutable
|
private boolean |
includeAntRuntime
|
private boolean |
includeJavaRuntime
|
private static java.lang.String |
JAVAC11
|
private static java.lang.String |
JAVAC12
|
private static java.lang.String |
JAVAC13
|
private static java.lang.String |
JAVAC14
|
private static java.lang.String |
JAVAC15
|
private static java.lang.String |
JAVAC16
|
protected boolean |
listFiles
|
private java.lang.String |
memoryInitialSize
|
private java.lang.String |
memoryMaximumSize
|
private static java.lang.String |
MODERN
|
private boolean |
nowarn
|
private boolean |
optimize
|
private java.lang.String |
source
|
private org.apache.tools.ant.types.Path |
src
|
private java.lang.String |
targetAttribute
|
private java.io.File |
tmpDir
|
private boolean |
verbose
|
Fields inherited from class org.apache.tools.ant.taskdefs.MatchingTask |
---|
fileset |
Fields inherited from class org.apache.tools.ant.Task |
---|
target, taskName, taskType, wrapper |
Fields inherited from class org.apache.tools.ant.ProjectComponent |
---|
description, location, project |
Constructor Summary | |
---|---|
Javac()
Javac task for compilation of Java files. |
Method Summary | |
---|---|
private java.lang.String |
assumedJavaVersion()
|
protected void |
checkParameters()
Check that all required attributes have been set and nothing silly has been entered. |
protected void |
compile()
Perform the compilation. |
org.apache.tools.ant.types.Path |
createBootclasspath()
Adds a path to the bootclasspath. |
org.apache.tools.ant.types.Path |
createClasspath()
Adds a path to the classpath. |
org.apache.tools.ant.taskdefs.Javac.ImplementationSpecificArgument |
createCompilerArg()
Adds an implementation specific command-line argument. |
org.apache.tools.ant.types.Path |
createExtdirs()
Adds a path to extdirs. |
org.apache.tools.ant.types.Path |
createSourcepath()
Adds a path to sourcepath. |
org.apache.tools.ant.types.Path |
createSrc()
Adds a path for source compilation. |
void |
execute()
Executes the task. |
private java.lang.String |
getAltCompilerName(java.lang.String anImplementation)
|
org.apache.tools.ant.types.Path |
getBootclasspath()
Gets the bootclasspath that will be used to compile the classes against. |
org.apache.tools.ant.types.Path |
getClasspath()
Gets the classpath to be used for this compilation. |
java.lang.String |
getCompiler()
The implementation for this particular task. |
java.lang.String |
getCompilerVersion()
The implementation for this particular task. |
java.lang.String[] |
getCurrentCompilerArgs()
Get the additional implementation specific command line arguments. |
boolean |
getDebug()
Gets the debug flag. |
java.lang.String |
getDebugLevel()
Get the value of debugLevel. |
boolean |
getDepend()
Gets the depend flag. |
boolean |
getDeprecation()
Gets the deprecation flag. |
java.io.File |
getDestdir()
Gets the destination directory into which the java source files should be compiled. |
java.lang.String |
getEncoding()
Gets the java source file encoding name. |
java.lang.String |
getExecutable()
The value of the executable attribute, if any. |
org.apache.tools.ant.types.Path |
getExtdirs()
Gets the extension directories that will be used during the compilation. |
boolean |
getFailonerror()
Gets the failonerror flag. |
java.io.File[] |
getFileList()
Gets the list of files to be compiled. |
boolean |
getIncludeantruntime()
Gets whether or not the ant classpath is to be included in the classpath. |
boolean |
getIncludejavaruntime()
Gets whether or not the java runtime should be included in this task's classpath. |
java.lang.String |
getJavacExecutable()
The name of the javac executable to use in fork-mode. |
boolean |
getListfiles()
Get the listfiles flag. |
java.lang.String |
getMemoryInitialSize()
Gets the memoryInitialSize flag. |
java.lang.String |
getMemoryMaximumSize()
Gets the memoryMaximumSize flag. |
boolean |
getNowarn()
Should the -nowarn option be used. |
boolean |
getOptimize()
Gets the optimize flag. |
java.lang.String |
getSource()
Get the value of source. |
org.apache.tools.ant.types.Path |
getSourcepath()
Gets the sourcepath to be used for this compilation. |
org.apache.tools.ant.types.Path |
getSrcdir()
Gets the source dirs to find the source java files. |
protected java.lang.String |
getSystemJavac()
|
java.lang.String |
getTarget()
Gets the target VM that the classes will be compiled for. |
java.io.File |
getTempdir()
Where Ant should place temporary files. |
boolean |
getVerbose()
Gets the verbose flag. |
boolean |
isForkedJavac()
Is this a forked invocation of JDK's javac? |
protected boolean |
isJdkCompiler(java.lang.String compilerImpl)
Is the compiler implementation a jdk compiler |
protected org.apache.tools.ant.types.Path |
recreateSrc()
Recreate src. |
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. |
void |
setBootclasspath(org.apache.tools.ant.types.Path bootclasspath)
Sets the bootclasspath that will be used to compile the classes against. |
void |
setBootClasspathRef(org.apache.tools.ant.types.Reference r)
Adds a reference to a classpath defined elsewhere. |
void |
setClasspath(org.apache.tools.ant.types.Path classpath)
Set the classpath to be used for this compilation. |
void |
setClasspathRef(org.apache.tools.ant.types.Reference r)
Adds a reference to a classpath defined elsewhere. |
void |
setCompiler(java.lang.String compiler)
Choose the implementation for this particular task. |
void |
setDebug(boolean debug)
Indicates whether source should be compiled with debug information; defaults to off. |
void |
setDebugLevel(java.lang.String v)
Keyword list to be appended to the -g command-line switch. |
void |
setDepend(boolean depend)
Enables dependency-tracking for compilers that support this (jikes and classic). |
void |
setDeprecation(boolean deprecation)
Indicates whether source should be compiled with deprecation information; defaults to off. |
void |
setDestdir(java.io.File destDir)
Set the destination directory into which the Java source files should be compiled. |
void |
setEncoding(java.lang.String encoding)
Set the Java source file encoding name. |
void |
setExecutable(java.lang.String forkExec)
Sets the name of the javac executable. |
void |
setExtdirs(org.apache.tools.ant.types.Path extdirs)
Sets the extension directories that will be used during the compilation. |
void |
setFailonerror(boolean fail)
Indicates whether the build will continue even if there are compilation errors; defaults to true. |
void |
setFork(boolean f)
If true, forks the javac compiler. |
void |
setIncludeantruntime(boolean include)
If true, includes Ant's own classpath in the classpath. |
void |
setIncludejavaruntime(boolean include)
If true, includes the Java runtime libraries in the classpath. |
void |
setListfiles(boolean list)
If true, list the source files being handed off to the compiler. |
void |
setMemoryInitialSize(java.lang.String memoryInitialSize)
The initial size of the memory for the underlying VM if javac is run externally; ignored otherwise. |
void |
setMemoryMaximumSize(java.lang.String memoryMaximumSize)
The maximum size of the memory for the underlying VM if javac is run externally; ignored otherwise. |
void |
setNowarn(boolean flag)
If true, enables the -nowarn option. |
void |
setOptimize(boolean optimize)
If true, compiles with optimization enabled. |
void |
setProceed(boolean proceed)
|
void |
setSource(java.lang.String v)
Value of the -source command-line switch; will be ignored by all implementations except modern and jikes. |
void |
setSourcepath(org.apache.tools.ant.types.Path sourcepath)
Set the sourcepath to be used for this compilation. |
void |
setSourcepathRef(org.apache.tools.ant.types.Reference r)
Adds a reference to a source path defined elsewhere. |
void |
setSrcdir(org.apache.tools.ant.types.Path srcDir)
Set the source directories to find the source Java files. |
void |
setTarget(java.lang.String target)
Sets the target VM that the classes will be compiled for. |
void |
setTempdir(java.io.File tmpDir)
Where Ant should place temporary files. |
void |
setVerbose(boolean verbose)
If true, asks the compiler for verbose output. |
Methods inherited from class org.apache.tools.ant.taskdefs.Javac |
---|
add, createCompilerClasspath, getTaskSuccess, isIncludeDestClasses, setErrorProperty, setIncludeDestClasses, setUpdatedProperty |
Methods inherited from class org.apache.tools.ant.taskdefs.MatchingTask |
---|
add, addAnd, addContains, addContainsRegexp, addCustom, addDate, addDepend, addDepth, addDifferent, addFilename, addMajority, addModified, addNone, addNot, addOr, addPresent, addSelector, addSize, addType, appendSelector, createExclude, createExcludesFile, createInclude, createIncludesFile, createPatternSet, getDirectoryScanner, getImplicitFileSet, getSelectors, hasSelectors, selectorCount, selectorElements, setCaseSensitive, setDefaultexcludes, setExcludes, setExcludesfile, setFollowSymlinks, setIncludes, setIncludesfile, setProject, XsetIgnore, XsetItems |
Methods inherited from class org.apache.tools.ant.Task |
---|
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType |
Methods inherited from class org.apache.tools.ant.ProjectComponent |
---|
clone, getDescription, getLocation, getProject, setDescription, setLocation |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final java.lang.String FAIL_MSG
private static final java.lang.String JAVAC16
private static final java.lang.String JAVAC15
private static final java.lang.String JAVAC14
private static final java.lang.String JAVAC13
private static final java.lang.String JAVAC12
private static final java.lang.String JAVAC11
private static final java.lang.String MODERN
private static final java.lang.String CLASSIC
private static final java.lang.String EXTJAVAC
private org.apache.tools.ant.types.Path src
private java.io.File destDir
private org.apache.tools.ant.types.Path compileClasspath
private org.apache.tools.ant.types.Path compileSourcepath
private java.lang.String encoding
private boolean debug
private boolean optimize
private boolean deprecation
private boolean depend
private boolean verbose
private java.lang.String targetAttribute
private org.apache.tools.ant.types.Path bootclasspath
private org.apache.tools.ant.types.Path extdirs
private boolean includeAntRuntime
private boolean includeJavaRuntime
private boolean fork
private java.lang.String forkedExecutable
private boolean nowarn
private java.lang.String memoryInitialSize
private java.lang.String memoryMaximumSize
private org.apache.tools.ant.util.facade.FacadeTaskHelper facade
protected boolean failOnError
protected boolean listFiles
protected java.io.File[] compileList
private java.lang.String source
private java.lang.String debugLevel
private java.io.File tmpDir
Constructor Detail |
---|
public Javac()
Method Detail |
---|
private java.lang.String assumedJavaVersion()
public java.lang.String getDebugLevel()
getDebugLevel
in class org.apache.tools.ant.taskdefs.Javac
public void setDebugLevel(java.lang.String v)
setDebugLevel
in class org.apache.tools.ant.taskdefs.Javac
v
- Value to assign to debugLevel.public java.lang.String getSource()
getSource
in class org.apache.tools.ant.taskdefs.Javac
public void setSource(java.lang.String v)
setSource
in class org.apache.tools.ant.taskdefs.Javac
v
- Value to assign to source.public org.apache.tools.ant.types.Path createSrc()
createSrc
in class org.apache.tools.ant.taskdefs.Javac
protected org.apache.tools.ant.types.Path recreateSrc()
recreateSrc
in class org.apache.tools.ant.taskdefs.Javac
public void setSrcdir(org.apache.tools.ant.types.Path srcDir)
setSrcdir
in class org.apache.tools.ant.taskdefs.Javac
srcDir
- the source directories as a pathpublic org.apache.tools.ant.types.Path getSrcdir()
getSrcdir
in class org.apache.tools.ant.taskdefs.Javac
public void setDestdir(java.io.File destDir)
setDestdir
in class org.apache.tools.ant.taskdefs.Javac
destDir
- the destination directorpublic java.io.File getDestdir()
getDestdir
in class org.apache.tools.ant.taskdefs.Javac
public void setSourcepath(org.apache.tools.ant.types.Path sourcepath)
setSourcepath
in class org.apache.tools.ant.taskdefs.Javac
sourcepath
- the source pathpublic org.apache.tools.ant.types.Path getSourcepath()
getSourcepath
in class org.apache.tools.ant.taskdefs.Javac
public org.apache.tools.ant.types.Path createSourcepath()
createSourcepath
in class org.apache.tools.ant.taskdefs.Javac
public void setSourcepathRef(org.apache.tools.ant.types.Reference r)
setSourcepathRef
in class org.apache.tools.ant.taskdefs.Javac
r
- a reference to a source pathpublic void setClasspath(org.apache.tools.ant.types.Path classpath)
setClasspath
in class org.apache.tools.ant.taskdefs.Javac
classpath
- an Ant Path object containing the compilation classpath.public org.apache.tools.ant.types.Path getClasspath()
getClasspath
in class org.apache.tools.ant.taskdefs.Javac
public org.apache.tools.ant.types.Path createClasspath()
createClasspath
in class org.apache.tools.ant.taskdefs.Javac
public void setClasspathRef(org.apache.tools.ant.types.Reference r)
setClasspathRef
in class org.apache.tools.ant.taskdefs.Javac
r
- a reference to a classpathpublic void setBootclasspath(org.apache.tools.ant.types.Path bootclasspath)
setBootclasspath
in class org.apache.tools.ant.taskdefs.Javac
bootclasspath
- a path to use as a boot class path (may be more
than one)public org.apache.tools.ant.types.Path getBootclasspath()
getBootclasspath
in class org.apache.tools.ant.taskdefs.Javac
public org.apache.tools.ant.types.Path createBootclasspath()
createBootclasspath
in class org.apache.tools.ant.taskdefs.Javac
public void setBootClasspathRef(org.apache.tools.ant.types.Reference r)
setBootClasspathRef
in class org.apache.tools.ant.taskdefs.Javac
r
- a reference to a classpathpublic void setExtdirs(org.apache.tools.ant.types.Path extdirs)
setExtdirs
in class org.apache.tools.ant.taskdefs.Javac
extdirs
- a pathpublic org.apache.tools.ant.types.Path getExtdirs()
getExtdirs
in class org.apache.tools.ant.taskdefs.Javac
public org.apache.tools.ant.types.Path createExtdirs()
createExtdirs
in class org.apache.tools.ant.taskdefs.Javac
public void setListfiles(boolean list)
setListfiles
in class org.apache.tools.ant.taskdefs.Javac
list
- if true list the source filespublic boolean getListfiles()
getListfiles
in class org.apache.tools.ant.taskdefs.Javac
public void setFailonerror(boolean fail)
setFailonerror
in class org.apache.tools.ant.taskdefs.Javac
fail
- if true halt the build on failurepublic void setProceed(boolean proceed)
setProceed
in class org.apache.tools.ant.taskdefs.Javac
proceed
- inverse of failoferrorpublic boolean getFailonerror()
getFailonerror
in class org.apache.tools.ant.taskdefs.Javac
public void setDeprecation(boolean deprecation)
setDeprecation
in class org.apache.tools.ant.taskdefs.Javac
deprecation
- if true turn on deprecation informationpublic boolean getDeprecation()
getDeprecation
in class org.apache.tools.ant.taskdefs.Javac
public void setMemoryInitialSize(java.lang.String memoryInitialSize)
setMemoryInitialSize
in class org.apache.tools.ant.taskdefs.Javac
memoryInitialSize
- string to pass to VMpublic java.lang.String getMemoryInitialSize()
getMemoryInitialSize
in class org.apache.tools.ant.taskdefs.Javac
public void setMemoryMaximumSize(java.lang.String memoryMaximumSize)
setMemoryMaximumSize
in class org.apache.tools.ant.taskdefs.Javac
memoryMaximumSize
- string to pass to VMpublic java.lang.String getMemoryMaximumSize()
getMemoryMaximumSize
in class org.apache.tools.ant.taskdefs.Javac
public void setEncoding(java.lang.String encoding)
setEncoding
in class org.apache.tools.ant.taskdefs.Javac
encoding
- the source file encodingpublic java.lang.String getEncoding()
getEncoding
in class org.apache.tools.ant.taskdefs.Javac
public void setDebug(boolean debug)
setDebug
in class org.apache.tools.ant.taskdefs.Javac
debug
- if true compile with debug informationpublic boolean getDebug()
getDebug
in class org.apache.tools.ant.taskdefs.Javac
public void setOptimize(boolean optimize)
setOptimize
in class org.apache.tools.ant.taskdefs.Javac
optimize
- if true compile with optimization enabledpublic boolean getOptimize()
getOptimize
in class org.apache.tools.ant.taskdefs.Javac
public void setDepend(boolean depend)
setDepend
in class org.apache.tools.ant.taskdefs.Javac
depend
- if true enable dependency-trackingpublic boolean getDepend()
getDepend
in class org.apache.tools.ant.taskdefs.Javac
public void setVerbose(boolean verbose)
setVerbose
in class org.apache.tools.ant.taskdefs.Javac
verbose
- if true, asks the compiler for verbose outputpublic boolean getVerbose()
getVerbose
in class org.apache.tools.ant.taskdefs.Javac
public void setTarget(java.lang.String target)
setTarget
in class org.apache.tools.ant.taskdefs.Javac
target
- the target VMpublic java.lang.String getTarget()
getTarget
in class org.apache.tools.ant.taskdefs.Javac
public void setIncludeantruntime(boolean include)
setIncludeantruntime
in class org.apache.tools.ant.taskdefs.Javac
include
- if true, includes Ant's own classpath in the classpathpublic boolean getIncludeantruntime()
getIncludeantruntime
in class org.apache.tools.ant.taskdefs.Javac
public void setIncludejavaruntime(boolean include)
setIncludejavaruntime
in class org.apache.tools.ant.taskdefs.Javac
include
- if true, includes the Java runtime libraries in the classpathpublic boolean getIncludejavaruntime()
getIncludejavaruntime
in class org.apache.tools.ant.taskdefs.Javac
public void setFork(boolean f)
setFork
in class org.apache.tools.ant.taskdefs.Javac
f
- "true|false|on|off|yes|no"public void setExecutable(java.lang.String forkExec)
Ignored unless fork is true or extJavac has been specified as the compiler.
setExecutable
in class org.apache.tools.ant.taskdefs.Javac
forkExec
- the name of the executablepublic java.lang.String getExecutable()
getExecutable
in class org.apache.tools.ant.taskdefs.Javac
public boolean isForkedJavac()
isForkedJavac
in class org.apache.tools.ant.taskdefs.Javac
public java.lang.String getJavacExecutable()
This is either the name specified with the executable attribute or the full path of the javac compiler of the VM Ant is currently running in - guessed by Ant.
You should not invoke this method if you
want to get the value of the executable command - use getExecutable
for this.
getJavacExecutable
in class org.apache.tools.ant.taskdefs.Javac
public void setNowarn(boolean flag)
setNowarn
in class org.apache.tools.ant.taskdefs.Javac
flag
- if true, enable the -nowarn optionpublic boolean getNowarn()
getNowarn
in class org.apache.tools.ant.taskdefs.Javac
public org.apache.tools.ant.taskdefs.Javac.ImplementationSpecificArgument createCompilerArg()
createCompilerArg
in class org.apache.tools.ant.taskdefs.Javac
public java.lang.String[] getCurrentCompilerArgs()
getCurrentCompilerArgs
in class org.apache.tools.ant.taskdefs.Javac
private java.lang.String getAltCompilerName(java.lang.String anImplementation)
public void setTempdir(java.io.File tmpDir)
setTempdir
in class org.apache.tools.ant.taskdefs.Javac
tmpDir
- the temporary directorypublic java.io.File getTempdir()
getTempdir
in class org.apache.tools.ant.taskdefs.Javac
public void execute() throws org.apache.tools.ant.BuildException
execute
in class org.apache.tools.ant.taskdefs.Javac
org.apache.tools.ant.BuildException
- if an error occursprotected void resetFileLists()
resetFileLists
in class org.apache.tools.ant.taskdefs.Javac
protected void scanDir(java.io.File srcDir, java.io.File destDir, java.lang.String[] files)
scanDir
in class org.apache.tools.ant.taskdefs.Javac
srcDir
- The source directorydestDir
- The destination directoryfiles
- An array of filenamespublic java.io.File[] getFileList()
getFileList
in class org.apache.tools.ant.taskdefs.Javac
protected boolean isJdkCompiler(java.lang.String compilerImpl)
isJdkCompiler
in class org.apache.tools.ant.taskdefs.Javac
compilerImpl
- the name of the compiler implementation
protected java.lang.String getSystemJavac()
getSystemJavac
in class org.apache.tools.ant.taskdefs.Javac
public void setCompiler(java.lang.String compiler)
setCompiler
in class org.apache.tools.ant.taskdefs.Javac
compiler
- the name of the compilerpublic java.lang.String getCompiler()
Defaults to the build.compiler property but can be overridden via the compiler and fork attributes.
If fork has been set to true, the result will be extJavac and not classic or java1.2 - no matter what the compiler attribute looks like.
getCompiler
in class org.apache.tools.ant.taskdefs.Javac
getCompilerVersion()
public java.lang.String getCompilerVersion()
Defaults to the build.compiler property but can be overridden via the compiler attribute.
This method does not take the fork attribute into account.
getCompilerVersion
in class org.apache.tools.ant.taskdefs.Javac
getCompiler()
protected void checkParameters() throws org.apache.tools.ant.BuildException
checkParameters
in class org.apache.tools.ant.taskdefs.Javac
org.apache.tools.ant.BuildException
- if an error occursprotected void compile()
compile
in class org.apache.tools.ant.taskdefs.Javac
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |