org.apache.tools.ant
Class Project

public class Project
Central representation of an Ant project. This class defines an Ant project with all of its targets, tasks and various other properties. It also provides the mechanism to kick off a build using a particular target name.

This class also encapsulates methods which allow files to be referred to using abstract path names which are translated to native system file paths at runtime.

SinceNot specified.
VersionNot specified.
AuthorNot specified.
Wiki javadoc Use textile entry format.
Add your comments here.
Field Summary
static String JAVA_1_0
Version constant for Java 1.0 .
static String JAVA_1_1
Version constant for Java 1.1 .
static String JAVA_1_2
Version constant for Java 1.2 .
static String JAVA_1_3
Version constant for Java 1.3 .
static String JAVA_1_4
Version constant for Java 1.4 .
static int MSG_DEBUG
Message priority of "debug".
static int MSG_ERR
Message priority of "error".
static int MSG_INFO
Message priority of "information".
static int MSG_VERBOSE
Message priority of "verbose".
static int MSG_WARN
Message priority of "warning".
static String TOKEN_END
Default filter end token.
static String TOKEN_START
Default filter start token.
Constructor Summary
Project()
Create a new Ant project.
Method Summary
void addBuildListener( BuildListener listener )
Add a build listener to the list.
void addDataTypeDefinition( String typeName, Class typeClass )
Add a new datatype definition.
void addFilter( String token, String value )
Add a filter to the set of global filters.
void addOrReplaceTarget( Target target )
Add a target to the project, or replaces one with the same name.
void addOrReplaceTarget( String targetName, Target target )
Add a target to the project, or replaces one with the same name.
void addReference( String name, Object value )
Add a reference to the project.
void addTarget( Target target )
Add a new target to the project.
void addTarget( String targetName, Target target )
Add a new target to the project.
void addTaskDefinition( String taskName, Class taskClass )
Add a new task definition to the project.
void checkTaskClass( Class taskClass )
Check whether or not a class is suitable for serving as Ant task.
void copyFile( String sourceFile, String destFile )
Convenience method to copy a file from a source to a destination.
void copyFile( String sourceFile, String destFile, boolean filtering )
Convenience method to copy a file from a source to a destination specifying if token filtering should be used.
void copyFile( String sourceFile, String destFile, boolean filtering, boolean overwrite )
Convenience method to copy a file from a source to a destination specifying if token filtering should be used and if source files may overwrite newer destination files.
void copyFile( String sourceFile, String destFile, boolean filtering, boolean overwrite, boolean preserveLastModified )
Convenience method to copy a file from a source to a destination specifying if token filtering should be used, if source files may overwrite newer destination files, and if the last modified time of the resulting file should be set to that of the source file.
void copyFile( File sourceFile, File destFile )
Convenience method to copy a file from a source to a destination.
void copyFile( File sourceFile, File destFile, boolean filtering )
Convenience method to copy a file from a source to a destination specifying if token filtering should be used.
void copyFile( File sourceFile, File destFile, boolean filtering, boolean overwrite )
Convenience method to copy a file from a source to a destination specifying if token filtering should be used and if source files may overwrite newer destination files.
void copyFile( File sourceFile, File destFile, boolean filtering, boolean overwrite, boolean preserveLastModified )
Convenience method to copy a file from a source to a destination specifying if token filtering should be used, if source files may overwrite newer destination files, and if the last modified time of the resulting file should be set to that of the source file.
void copyInheritedProperties( Project other )
Copy all user properties that have not been set on the command line or a GUI tool from this instance to the Project instance given as the argument.
void copyUserProperties( Project other )
Copy all user properties that have been set on the command line or a GUI tool from this instance to the Project instance given as the argument.
AntClassLoader createClassLoader( Path path )
Factory method to create a class loader for loading classes from a given path.
Object createDataType( String typeName )
Create a new instance of a data type.
Task createTask( String taskType )
Create a new instance of a task, adding it to a list of created tasks for later invalidation.
int defaultInput( byte [] buffer, int offset, int length )
Read data from the default input stream.
void demuxFlush( String output, boolean isError )
Demultiplex flush operations so that each task receives the appropriate messages.
int demuxInput( byte [] buffer, int offset, int length )
Demux an input request to the correct task.
void demuxOutput( String output, boolean isWarning )
Demultiplex output so that each task receives the appropriate messages.
void executeSortedTargets( Vector sortedTargets )
Execute a Vector of sorted targets.
void executeTarget( String targetName )
Execute the specified target and any targets it depends on.
void executeTargets( Vector names )
Execute the specified sequence of targets, and the targets they depend on.
void fireBuildFinished( Throwable exception )
Send a "build finished" event to the build listeners for this project.
void fireBuildStarted()
Send a "build started" event to the build listeners for this project.
protected void fireMessageLogged( Project project, String message, int priority )
Send a "message logged" project level event to the build listeners for this project.
protected void fireMessageLogged( Target target, String message, int priority )
Send a "message logged" target level event to the build listeners for this project.
protected void fireMessageLogged( Task task, String message, int priority )
Send a "message logged" task level event to the build listeners for this project.
void fireSubBuildFinished( Throwable exception )
Send a "subbuild finished" event to the build listeners for this project.
void fireSubBuildStarted()
Send a "subbuild started" event to the build listeners for this project.
protected void fireTargetFinished( Target target, Throwable exception )
Send a "target finished" event to the build listeners for this project.
protected void fireTargetStarted( Target target )
Send a "target started" event to the build listeners for this project.
protected void fireTaskFinished( Task task, Throwable exception )
Send a "task finished" event to the build listeners for this project.
protected void fireTaskStarted( Task task )
Send a "task started" event to the build listeners for this project.
File getBaseDir()
Return the base directory of the project as a file object.
Vector getBuildListeners()
Return a copy of the list of build listeners for the project.
ClassLoader getCoreLoader()
Return the core classloader to use for this project.
Hashtable getDataTypeDefinitions()
Return the current datatype definition hashtable.
InputStream getDefaultInputStream()
Get this project's input stream.
String getDefaultTarget()
Return the name of the default target of the project.
String getDescription()
Return the project description, if one has been set.
String getElementName( Object element )
Return a description of the type of the given element, with special handling for instances of tasks and data types.
Executor getExecutor()
Get this Project's Executor (setting it if necessary).
Hashtable getFilters()
Return a hashtable of global filters, mapping tokens to values.
FilterSet getGlobalFilterSet()
Return the set of global filters.
InputHandler getInputHandler()
Retrieve the current input handler.
static String getJavaVersion()
Return the version of Java this class is running under.
String getName()
Return the project name, if one has been set.
Hashtable getProperties()
Return a copy of the properties table.
String getProperty( String name )
Return the value of a property, if it is set.
Object getReference( String key )
Look up a reference by its key (ID).
Hashtable getReferences()
Return a map of the references in the project (String to Object).
Hashtable getTargets()
Return the hashtable of targets.
Hashtable getTaskDefinitions()
Return the current task definition hashtable.
Task getThreadTask( Thread thread )
Get the current task associated with a thread, if any.
Hashtable getUserProperties()
Return a copy of the user property hashtable.
String getUserProperty( String name )
Return the value of a user property, if it is set.
void init()
Initialise the project.
void initSubProject( Project subProject )
Init a sub project--used by taskdefs.Ant .
boolean isKeepGoingMode()
Return the keep-going mode.
void log( String message )
Write a message to the log with the default log level of MSG_INFO .
void log( String message, int msgLevel )
Write a project level message to the log with the given log level.
void log( Task task, String message, int msgLevel )
Write a task level message to the log with the given log level.
void log( Target target, String message, int msgLevel )
Write a target level message to the log with the given log level.
void registerThreadTask( Thread thread, Task task )
Register a task as the current task for a thread.
void removeBuildListener( BuildListener listener )
Remove a build listener from the list.
String replaceProperties( String value )
Replace ${} style constructions in the given value with the string value of the corresponding data types.
File resolveFile( String fileName, File rootDir )
Return the canonical form of a filename.
File resolveFile( String fileName )
Return the canonical form of a filename.
void setBasedir( String baseD )
Set the base directory for the project, checking that the given filename exists and is a directory.
void setBaseDir( File baseDir )
Set the base directory for the project, checking that the given file exists and is a directory.
void setCoreLoader( ClassLoader coreLoader )
Set the core classloader for the project.
void setDefault( String defaultTarget )
Set the default target of the project.
void setDefaultInputStream( InputStream defaultInputStream )
Set the default System input stream.
void setDefaultTarget( String defaultTarget )
Set the default target of the project.
void setDescription( String description )
Set the project description.
void setExecutor( Executor e )
Set the Executor instance for this Project.
void setFileLastModified( File file, long time )
Call File.setLastModified(long time) on Java above 1.1, and logs a warning on Java 1.1.
void setInheritedProperty( String name, String value )
Set a user property, which cannot be overwritten by set/unset property calls.
void setInputHandler( InputHandler handler )
Set the input handler.
void setJavaVersionProperty()
Set the ant.java.version property and tests for unsupported JVM versions.
void setKeepGoingMode( boolean keepGoingMode )
Set "keep-going" mode.
void setName( String name )
Set the name of the project, also setting the user property ant.project.name.
void setNewProperty( String name, String value )
Set a property if no value currently exists.
void setProjectReference( Object obj )
Set a reference to this Project on the parameterized object.
void setProperty( String name, String value )
Set a property.
void setSystemProperties()
Add all system properties which aren't already defined as user properties to the project properties.
void setUserProperty( String name, String value )
Set a user property, which cannot be overwritten by set/unset property calls.
static boolean toBoolean( String s )
Return the boolean equivalent of a string, which is considered true if either "on", "true", or "yes" is found, ignoring case.
Vector topoSort( String root, Hashtable targets )
Topologically sort a set of targets.
Vector topoSort( String root, Hashtable targets, boolean returnAll )
Topologically sort a set of targets.
Vector topoSort( String [] root, Hashtable targets, boolean returnAll )
Topologically sort a set of targets.
static String translatePath( String toProcess )
Translate a path into its native (platform specific) format.
JAVA_1_0
public static String JAVA_1_0
Version constant for Java 1.0 .
Wiki javadoc Use textile entry format.
Add your comments here.
JAVA_1_1
public static String JAVA_1_1
Version constant for Java 1.1 .
Wiki javadoc Use textile entry format.
Add your comments here.
JAVA_1_2
public static String JAVA_1_2
Version constant for Java 1.2 .
Wiki javadoc Use textile entry format.
Add your comments here.
JAVA_1_3
public static String JAVA_1_3
Version constant for Java 1.3 .
Wiki javadoc Use textile entry format.
Add your comments here.
JAVA_1_4
public static String JAVA_1_4
Version constant for Java 1.4 .
Wiki javadoc Use textile entry format.
Add your comments here.
MSG_DEBUG
public static int MSG_DEBUG
Message priority of "debug".
Wiki javadoc Use textile entry format.
Add your comments here.
MSG_ERR
public static int MSG_ERR
Message priority of "error".
Wiki javadoc Use textile entry format.
Add your comments here.
MSG_INFO
public static int MSG_INFO
Message priority of "information".
Wiki javadoc Use textile entry format.
Add your comments here.
MSG_VERBOSE
public static int MSG_VERBOSE
Message priority of "verbose".
Wiki javadoc Use textile entry format.
Add your comments here.
MSG_WARN
public static int MSG_WARN
Message priority of "warning".
Wiki javadoc Use textile entry format.
Add your comments here.
TOKEN_END
public static String TOKEN_END
Default filter end token.
Wiki javadoc Use textile entry format.
Add your comments here.
TOKEN_START
public static String TOKEN_START
Default filter start token.
Wiki javadoc Use textile entry format.
Add your comments here.
Project
public Project ( )
Create a new Ant project.
Wiki javadoc Use textile entry format.
Add your comments here.
addBuildListener
public void addBuildListener ( BuildListener listener )
Add a build listener to the list. This listener will be notified of build events for this project.
Parameters
TypeNameDescription
BuildListener listener The listener to add to the list. Must not be null.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
addDataTypeDefinition
public void addDataTypeDefinition ( String typeName, Class typeClass )
Add a new datatype definition. Attempting to override an existing definition with an equivalent one (i.e. with the same classname) results in a verbose log message. Attempting to override an existing definition with a different one results in a warning log message, but the definition is changed.
Parameters
TypeNameDescription
String typeName The name of the datatype. Must not be null.
Class typeClass The full name of the class implementing the datatype. Must not be null.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
addFilter
public void addFilter ( String token, String value )
Add a filter to the set of global filters.
Parameters
TypeNameDescription
String token The token to filter. Must not be null.
String value The replacement value. Must not be null.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
addOrReplaceTarget
public void addOrReplaceTarget ( Target target )
Add a target to the project, or replaces one with the same name.
Parameters
TypeNameDescription
Target target The target to be added or replaced in the project. Must not be null.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
addOrReplaceTarget
public void addOrReplaceTarget ( String targetName, Target target )
Add a target to the project, or replaces one with the same name.
Parameters
TypeNameDescription
String targetName The name to use for the target. Must not be null.
Target target The target to be added or replaced in the project. Must not be null.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
addReference
public void addReference ( String name, Object value )
Add a reference to the project.
Parameters
TypeNameDescription
String name The name of the reference. Must not be null.
Object value The value of the reference. Must not be null.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
addTarget
public void addTarget ( Target target )
Add a new target to the project.
Parameters
TypeNameDescription
Target target The target to be added to the project. Must not be null.
Returns void No description provided.
Exceptions
BuildException if the target already exists in the project
Wiki javadoc Use textile entry format.
Add your comments here.
addTarget
public void addTarget ( String targetName, Target target )
Add a new target to the project.
Parameters
TypeNameDescription
String targetName The name to use for the target. Must not be null.
Target target The target to be added to the project. Must not be null.
Returns void No description provided.
Exceptions
BuildException if the target already exists in the project.
Wiki javadoc Use textile entry format.
Add your comments here.
addTaskDefinition
public void addTaskDefinition ( String taskName, Class taskClass )
Add a new task definition to the project. Attempting to override an existing definition with an equivalent one (i.e. with the same classname) results in a verbose log message. Attempting to override an existing definition with a different one results in a warning log message and invalidates any tasks which have already been created with the old definition.
Parameters
TypeNameDescription
String taskName The name of the task to add. Must not be null.
Class taskClass The full name of the class implementing the task. Must not be null.
Returns void No description provided.
Exceptions
BuildException if the class is unsuitable for being an Ant task. An error level message is logged before this exception is thrown.
Wiki javadoc Use textile entry format.
Add your comments here.
checkTaskClass
public void checkTaskClass ( Class taskClass )
Check whether or not a class is suitable for serving as Ant task. Ant task implementation classes must be public, concrete, and have a no-arg constructor.
Parameters
TypeNameDescription
Class taskClass The class to be checked. Must not be null.
Returns void No description provided.
Exceptions
BuildException if the class is unsuitable for being an Ant task. An error level message is logged before this exception is thrown.
Wiki javadoc Use textile entry format.
Add your comments here.
copyFile
public void copyFile ( String sourceFile, String destFile )
throws
Convenience method to copy a file from a source to a destination. No filtering is performed.
Parameters
TypeNameDescription
String sourceFile Name of file to copy from. Must not be null.
String destFile Name of file to copy to. Must not be null.
Returns void No description provided.
Exceptions
IOException if the copying fails.
Wiki javadoc Use textile entry format.
Add your comments here.
copyFile
public void copyFile ( String sourceFile, String destFile, boolean filtering )
throws
Convenience method to copy a file from a source to a destination specifying if token filtering should be used.
Parameters
TypeNameDescription
String sourceFile Name of file to copy from. Must not be null.
String destFile Name of file to copy to. Must not be null.
boolean filtering Whether or not token filtering should be used during the copy.
Returns void No description provided.
Exceptions
IOException if the copying fails.
Wiki javadoc Use textile entry format.
Add your comments here.
copyFile
public void copyFile ( String sourceFile, String destFile, boolean filtering, boolean overwrite )
throws
Convenience method to copy a file from a source to a destination specifying if token filtering should be used and if source files may overwrite newer destination files.
Parameters
TypeNameDescription
String sourceFile Name of file to copy from. Must not be null.
String destFile Name of file to copy to. Must not be null.
boolean filtering Whether or not token filtering should be used during the copy.
boolean overwrite Whether or not the destination file should be overwritten if it already exists.
Returns void No description provided.
Exceptions
IOException if the copying fails.
Wiki javadoc Use textile entry format.
Add your comments here.
copyFile
public void copyFile ( String sourceFile, String destFile, boolean filtering, boolean overwrite, boolean preserveLastModified )
throws
Convenience method to copy a file from a source to a destination specifying if token filtering should be used, if source files may overwrite newer destination files, and if the last modified time of the resulting file should be set to that of the source file.
Parameters
TypeNameDescription
String sourceFile Name of file to copy from. Must not be null.
String destFile Name of file to copy to. Must not be null.
boolean filtering Whether or not token filtering should be used during the copy.
boolean overwrite Whether or not the destination file should be overwritten if it already exists.
boolean preserveLastModified Whether or not the last modified time of the resulting file should be set to that of the source file.
Returns void No description provided.
Exceptions
IOException if the copying fails.
Wiki javadoc Use textile entry format.
Add your comments here.
copyFile
public void copyFile ( File sourceFile, File destFile )
throws
Convenience method to copy a file from a source to a destination. No filtering is performed.
Parameters
TypeNameDescription
File sourceFile File to copy from. Must not be null.
File destFile File to copy to. Must not be null.
Returns void No description provided.
Exceptions
IOException if the copying fails.
Wiki javadoc Use textile entry format.
Add your comments here.
copyFile
public void copyFile ( File sourceFile, File destFile, boolean filtering )
throws
Convenience method to copy a file from a source to a destination specifying if token filtering should be used.
Parameters
TypeNameDescription
File sourceFile File to copy from. Must not be null.
File destFile File to copy to. Must not be null.
boolean filtering Whether or not token filtering should be used during the copy.
Returns void No description provided.
Exceptions
IOException if the copying fails.
Wiki javadoc Use textile entry format.
Add your comments here.
copyFile
public void copyFile ( File sourceFile, File destFile, boolean filtering, boolean overwrite )
throws
Convenience method to copy a file from a source to a destination specifying if token filtering should be used and if source files may overwrite newer destination files.
Parameters
TypeNameDescription
File sourceFile File to copy from. Must not be null.
File destFile File to copy to. Must not be null.
boolean filtering Whether or not token filtering should be used during the copy.
boolean overwrite Whether or not the destination file should be overwritten if it already exists.
Returns void No description provided.
Exceptions
IOException if the file cannot be copied.
Wiki javadoc Use textile entry format.
Add your comments here.
copyFile
public void copyFile ( File sourceFile, File destFile, boolean filtering, boolean overwrite, boolean preserveLastModified )
throws
Convenience method to copy a file from a source to a destination specifying if token filtering should be used, if source files may overwrite newer destination files, and if the last modified time of the resulting file should be set to that of the source file.
Parameters
TypeNameDescription
File sourceFile File to copy from. Must not be null.
File destFile File to copy to. Must not be null.
boolean filtering Whether or not token filtering should be used during the copy.
boolean overwrite Whether or not the destination file should be overwritten if it already exists.
boolean preserveLastModified Whether or not the last modified time of the resulting file should be set to that of the source file.
Returns void No description provided.
Exceptions
IOException if the file cannot be copied.
Wiki javadoc Use textile entry format.
Add your comments here.
copyInheritedProperties
public void copyInheritedProperties ( Project other )
Copy all user properties that have not been set on the command line or a GUI tool from this instance to the Project instance given as the argument.

To copy all "user" properties, you will also have to call copyUserProperties .

Since: Ant 1.5
Parameters
TypeNameDescription
Project other the project to copy the properties to. Must not be null.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
copyUserProperties
public void copyUserProperties ( Project other )
Copy all user properties that have been set on the command line or a GUI tool from this instance to the Project instance given as the argument.

To copy all "user" properties, you will also have to call copyInheritedProperties .

Since: Ant 1.5
Parameters
TypeNameDescription
Project other the project to copy the properties to. Must not be null.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
createClassLoader
public AntClassLoader createClassLoader ( Path path )
Factory method to create a class loader for loading classes from a given path.
Parameters
TypeNameDescription
Path path the path from which classes are to be loaded.
Wiki javadoc Use textile entry format.
Add your comments here.
createDataType
public Object createDataType ( String typeName )
Create a new instance of a data type.
Parameters
TypeNameDescription
String typeName The name of the data type to create an instance of. Must not be null.
Exceptions
BuildException if the data type name is recognised but instance creation fails.
Wiki javadoc Use textile entry format.
Add your comments here.
createTask
public Task createTask ( String taskType )
Create a new instance of a task, adding it to a list of created tasks for later invalidation. This causes all tasks to be remembered until the containing project is removed
Parameters
TypeNameDescription
String taskType The name of the task to create an instance of. Must not be null.
Exceptions
BuildException if the task name is recognised but task creation fails.
Wiki javadoc Use textile entry format.
Add your comments here.
defaultInput
public int defaultInput ( byte [] buffer, int offset, int length )
throws
Read data from the default input stream. If no default has been specified, System.in is used.
Since: Ant 1.6
Parameters
TypeNameDescription
byte[] buffer the buffer into which data is to be read.
int offset the offset into the buffer at which data is stored.
int length the amount of data to read.
Exceptions
IOException if the data cannot be read.
Wiki javadoc Use textile entry format.
Add your comments here.
demuxFlush
public void demuxFlush ( String output, boolean isError )
Demultiplex flush operations so that each task receives the appropriate messages. If the current thread is not currently executing a task, the message is logged directly.
Since: Ant 1.5.2
Parameters
TypeNameDescription
String output Message to handle. Should not be null.
boolean isError Whether the text represents an error (true) or information (false).
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
demuxInput
public int demuxInput ( byte [] buffer, int offset, int length )
throws
Demux an input request to the correct task.
Since: Ant 1.6
Parameters
TypeNameDescription
byte[] buffer the buffer into which data is to be read.
int offset the offset into the buffer at which data is stored.
int length the amount of data to read.
Exceptions
IOException if the data cannot be read.
Wiki javadoc Use textile entry format.
Add your comments here.
demuxOutput
public void demuxOutput ( String output, boolean isWarning )
Demultiplex output so that each task receives the appropriate messages. If the current thread is not currently executing a task, the message is logged directly.
Parameters
TypeNameDescription
String output Message to handle. Should not be null.
boolean isWarning Whether the text represents an warning (true) or information (false).
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
executeSortedTargets
public void executeSortedTargets ( Vector sortedTargets )
Execute a Vector of sorted targets.
Parameters
TypeNameDescription
Vector sortedTargets the aforementioned Vector.
Returns void No description provided.
Exceptions
BuildException on error.
Wiki javadoc Use textile entry format.
Add your comments here.
executeTarget
public void executeTarget ( String targetName )
Execute the specified target and any targets it depends on.
Parameters
TypeNameDescription
String targetName The name of the target to execute. Must not be null.
Returns void No description provided.
Exceptions
BuildException if the build failed.
Wiki javadoc Use textile entry format.
Add your comments here.
executeTargets
public void executeTargets ( Vector names )
Execute the specified sequence of targets, and the targets they depend on.
Parameters
TypeNameDescription
Vector names A vector of target name strings to execute. Must not be null.
Returns void No description provided.
Exceptions
BuildException if the build failed.
Wiki javadoc Use textile entry format.
Add your comments here.
fireBuildFinished
public void fireBuildFinished ( Throwable exception )
Send a "build finished" event to the build listeners for this project.
Parameters
TypeNameDescription
Throwable exception an exception indicating a reason for a build failure. May be null, indicating a successful build.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
fireBuildStarted
public void fireBuildStarted ( )
Send a "build started" event to the build listeners for this project.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
fireMessageLogged
protected void fireMessageLogged ( Project project, String message, int priority )
Send a "message logged" project level event to the build listeners for this project.
Parameters
TypeNameDescription
Project project The project generating the event. Should not be null.
String message The message to send. Should not be null.
int priority The priority of the message.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
fireMessageLogged
protected void fireMessageLogged ( Target target, String message, int priority )
Send a "message logged" target level event to the build listeners for this project.
Parameters
TypeNameDescription
Target target The target generating the event. Must not be null.
String message The message to send. Should not be null.
int priority The priority of the message.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
fireMessageLogged
protected void fireMessageLogged ( Task task, String message, int priority )
Send a "message logged" task level event to the build listeners for this project.
Parameters
TypeNameDescription
Task task The task generating the event. Must not be null.
String message The message to send. Should not be null.
int priority The priority of the message.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
fireSubBuildFinished
public void fireSubBuildFinished ( Throwable exception )
Send a "subbuild finished" event to the build listeners for this project.
Since: Ant 1.6.2
Parameters
TypeNameDescription
Throwable exception an exception indicating a reason for a build failure. May be null, indicating a successful build.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
fireSubBuildStarted
public void fireSubBuildStarted ( )
Send a "subbuild started" event to the build listeners for this project.
Since: Ant 1.6.2
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
fireTargetFinished
protected void fireTargetFinished ( Target target, Throwable exception )
Send a "target finished" event to the build listeners for this project.
Parameters
TypeNameDescription
Target target The target which has finished building. Must not be null.
Throwable exception an exception indicating a reason for a build failure. May be null, indicating a successful build.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
fireTargetStarted
protected void fireTargetStarted ( Target target )
Send a "target started" event to the build listeners for this project.
Parameters
TypeNameDescription
Target target The target which is starting to build. Must not be null.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
fireTaskFinished
protected void fireTaskFinished ( Task task, Throwable exception )
Send a "task finished" event to the build listeners for this project.
Parameters
TypeNameDescription
Task task The task which has finished executing. Must not be null.
Throwable exception an exception indicating a reason for a build failure. May be null, indicating a successful build.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
fireTaskStarted
protected void fireTaskStarted ( Task task )
Send a "task started" event to the build listeners for this project.
Parameters
TypeNameDescription
Task task The target which is starting to execute. Must not be null.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
getBaseDir
public File getBaseDir ( )
Return the base directory of the project as a file object.
Wiki javadoc Use textile entry format.
Add your comments here.
getBuildListeners
public Vector getBuildListeners ( )
Return a copy of the list of build listeners for the project.
Wiki javadoc Use textile entry format.
Add your comments here.
getCoreLoader
public ClassLoader getCoreLoader ( )
Return the core classloader to use for this project. This may be null, indicating that the parent classloader should be used.
Wiki javadoc Use textile entry format.
Add your comments here.
getDataTypeDefinitions
public Hashtable getDataTypeDefinitions ( )
Return the current datatype definition hashtable. The returned hashtable is "live" and so should not be modified.
Wiki javadoc Use textile entry format.
Add your comments here.
getDefaultInputStream
public InputStream getDefaultInputStream ( )
Get this project's input stream.
Wiki javadoc Use textile entry format.
Add your comments here.
getDefaultTarget
public String getDefaultTarget ( )
Return the name of the default target of the project.
Wiki javadoc Use textile entry format.
Add your comments here.
getDescription
public String getDescription ( )
Return the project description, if one has been set.
Wiki javadoc Use textile entry format.
Add your comments here.
getElementName
public String getElementName ( Object element )
Return a description of the type of the given element, with special handling for instances of tasks and data types.

This is useful for logging purposes.

Since: 1.95, Ant
Parameters
TypeNameDescription
Object element The element to describe. Must not be null.
Wiki javadoc Use textile entry format.
Add your comments here.
getExecutor
public Executor getExecutor ( )
Get this Project's Executor (setting it if necessary).
Wiki javadoc Use textile entry format.
Add your comments here.
getFilters
public Hashtable getFilters ( )
Return a hashtable of global filters, mapping tokens to values.
Wiki javadoc Use textile entry format.
Add your comments here.
getGlobalFilterSet
public FilterSet getGlobalFilterSet ( )
Return the set of global filters.
Wiki javadoc Use textile entry format.
Add your comments here.
getInputHandler
public InputHandler getInputHandler ( )
Retrieve the current input handler.
Wiki javadoc Use textile entry format.
Add your comments here.
getJavaVersion
public static String getJavaVersion ( )
Return the version of Java this class is running under.
See also
Wiki javadoc Use textile entry format.
Add your comments here.
getName
public String getName ( )
Return the project name, if one has been set.
Wiki javadoc Use textile entry format.
Add your comments here.
getProperties
public Hashtable getProperties ( )
Return a copy of the properties table.
Wiki javadoc Use textile entry format.
Add your comments here.
getProperty
public String getProperty ( String name )
Return the value of a property, if it is set.
Parameters
TypeNameDescription
String name The name of the property. May be null, in which case the return value is also null.
Wiki javadoc Use textile entry format.

name‘s:

sshOutput

getReference
public Object getReference ( String key )
Look up a reference by its key (ID).
Parameters
TypeNameDescription
String key The key for the desired reference. Must not be null.
Wiki javadoc Use textile entry format.
Add your comments here.
getReferences
public Hashtable getReferences ( )
Return a map of the references in the project (String to Object). The returned hashtable is "live" and so must not be modified.
Wiki javadoc Use textile entry format.
Add your comments here.
getTargets
public Hashtable getTargets ( )
Return the hashtable of targets. The returned hashtable is "live" and so should not be modified.
Wiki javadoc Use textile entry format.
Add your comments here.
getTaskDefinitions
public Hashtable getTaskDefinitions ( )
Return the current task definition hashtable. The returned hashtable is "live" and so should not be modified.
Wiki javadoc Use textile entry format.
Add your comments here.
getThreadTask
public Task getThreadTask ( Thread thread )
Get the current task associated with a thread, if any.
Parameters
TypeNameDescription
Thread thread the thread for which the task is required.
Wiki javadoc Use textile entry format.
Add your comments here.
getUserProperties
public Hashtable getUserProperties ( )
Return a copy of the user property hashtable.
Wiki javadoc Use textile entry format.
Add your comments here.
getUserProperty
public String getUserProperty ( String name )
Return the value of a user property, if it is set.
Parameters
TypeNameDescription
String name The name of the property. May be null, in which case the return value is also null.
Wiki javadoc Use textile entry format.
Add your comments here.
init
public void init ( )
Initialise the project. This involves setting the default task definitions and loading the system properties.
Returns void No description provided.
Exceptions
BuildException if the default task list cannot be loaded.
Wiki javadoc Use textile entry format.
Add your comments here.
initSubProject
public void initSubProject ( Project subProject )
Init a sub project--used by taskdefs.Ant .
Parameters
TypeNameDescription
Project subProject the subproject to initialize.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
isKeepGoingMode
public boolean isKeepGoingMode ( )
Return the keep-going mode. If the keepGoing settor/getter methods are used in conjunction with the ant.executor.class property, they will have no effect.
Since: Ant 1.6
Wiki javadoc Use textile entry format.
Add your comments here.
log
public void log ( String message )
Write a message to the log with the default log level of MSG_INFO .
Parameters
TypeNameDescription
String message The text to log. Should not be null.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
log
public void log ( String message, int msgLevel )
Write a project level message to the log with the given log level.
Parameters
TypeNameDescription
String message The text to log. Should not be null.
int msgLevel The log priority level to use.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
log
public void log ( Task task, String message, int msgLevel )
Write a task level message to the log with the given log level.
Parameters
TypeNameDescription
Task task The task to use in the log. Must not be null.
String message The text to log. Should not be null.
int msgLevel The log priority level to use.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
log
public void log ( Target target, String message, int msgLevel )
Write a target level message to the log with the given log level.
Parameters
TypeNameDescription
Target target The target to use in the log. Must not be null.
String message The text to log. Should not be null.
int msgLevel The log priority level to use.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
registerThreadTask
public void registerThreadTask ( Thread thread, Task task )
Register a task as the current task for a thread. If the task is null, the thread's entry is removed.
Since: Ant 1.5
Parameters
TypeNameDescription
Thread thread the thread on which the task is registered.
Task task the task to be registered.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
removeBuildListener
public void removeBuildListener ( BuildListener listener )
Remove a build listener from the list. This listener will no longer be notified of build events for this project.
Parameters
TypeNameDescription
BuildListener listener The listener to remove from the list. Should not be null.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
replaceProperties
public String replaceProperties ( String value )
Replace ${} style constructions in the given value with the string value of the corresponding data types.
Parameters
TypeNameDescription
String value The string to be scanned for property references. May be null.
Exceptions
BuildException if the given value has an unclosed property name, e.g. ${xxx.
Wiki javadoc Use textile entry format.
Add your comments here.
resolveFile
public File resolveFile ( String fileName, File rootDir )
Return the canonical form of a filename.

If the specified file name is relative it is resolved with respect to the given root directory.

Parameters
TypeNameDescription
String fileName The name of the file to resolve. Must not be null.
File rootDir The directory respective to which relative file names are resolved. May be null, in which case the current directory is used.
Wiki javadoc Use textile entry format.
Add your comments here.
resolveFile
public File resolveFile ( String fileName )
Return the canonical form of a filename.

If the specified file name is relative it is resolved with respect to the project's base directory.

Parameters
TypeNameDescription
String fileName The name of the file to resolve. Must not be null.
Wiki javadoc Use textile entry format.
Add your comments here.
setBasedir
public void setBasedir ( String baseD )
Set the base directory for the project, checking that the given filename exists and is a directory.
Parameters
TypeNameDescription
String baseD The project base directory. Must not be null.
Returns void No description provided.
Exceptions
BuildException if the directory if invalid.
Wiki javadoc Use textile entry format.
Add your comments here.
setBaseDir
public void setBaseDir ( File baseDir )
Set the base directory for the project, checking that the given file exists and is a directory.
Parameters
TypeNameDescription
File baseDir The project base directory. Must not be null.
Returns void No description provided.
Exceptions
BuildException if the specified file doesn't exist or isn't a directory.
Wiki javadoc Use textile entry format.
Add your comments here.
setCoreLoader
public void setCoreLoader ( ClassLoader coreLoader )
Set the core classloader for the project. If a null classloader is specified, the parent classloader should be used.
Parameters
TypeNameDescription
ClassLoader coreLoader The classloader to use for the project. May be null.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
setDefault
public void setDefault ( String defaultTarget )
Set the default target of the project.
Parameters
TypeNameDescription
String defaultTarget The name of the default target for this project. May be null, indicating that there is no default target.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
setDefaultInputStream
public void setDefaultInputStream ( InputStream defaultInputStream )
Set the default System input stream. Normally this stream is set to System.in. This inputStream is used when no task input redirection is being performed.
Since: Ant 1.6
Parameters
TypeNameDescription
InputStream defaultInputStream the default input stream to use when input is requested.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
setDefaultTarget
public void setDefaultTarget ( String defaultTarget )
Set the default target of the project.
Parameters
TypeNameDescription
String defaultTarget The name of the default target for this project. May be null, indicating that there is no default target.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
setDescription
public void setDescription ( String description )
Set the project description.
Parameters
TypeNameDescription
String description The description of the project. May be null.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
setExecutor
public void setExecutor ( Executor e )
Set the Executor instance for this Project.
Parameters
TypeNameDescription
Executor e the Executor to use.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
setFileLastModified
public void setFileLastModified ( File file, long time )
Call File.setLastModified(long time) on Java above 1.1, and logs a warning on Java 1.1.
Parameters
TypeNameDescription
File file The file to set the last modified time on. Must not be null.
long time the required modification time.
Returns void No description provided.
Exceptions
BuildException if the last modified time cannot be set despite running on a platform with a version above 1.1.
Wiki javadoc Use textile entry format.
Add your comments here.
setInheritedProperty
public void setInheritedProperty ( String name, String value )
Set a user property, which cannot be overwritten by set/unset property calls. Any previous value is overwritten. Also marks these properties as properties that have not come from the command line.
Parameters
TypeNameDescription
String name The name of property to set. Must not be null.
String value The new value of the property. Must not be null.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
setInputHandler
public void setInputHandler ( InputHandler handler )
Set the input handler.
Parameters
TypeNameDescription
InputHandler handler the InputHandler instance to use for gathering input.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
setJavaVersionProperty
public void setJavaVersionProperty ( )
Set the ant.java.version property and tests for unsupported JVM versions. If the version is supported, verbose log messages are generated to record the Java version and operating system name.
Returns void No description provided.
Exceptions
BuildException if this Java version is not supported.
See also
Wiki javadoc Use textile entry format.
Add your comments here.
setKeepGoingMode
public void setKeepGoingMode ( boolean keepGoingMode )
Set "keep-going" mode. In this mode Ant will try to execute as many targets as possible. All targets that do not depend on failed target(s) will be executed. If the keepGoing settor/getter methods are used in conjunction with the ant.executor.class property, they will have no effect.
Since: Ant 1.6
Parameters
TypeNameDescription
boolean keepGoingMode "keep-going" mode
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
setName
public void setName ( String name )
Set the name of the project, also setting the user property ant.project.name.
Parameters
TypeNameDescription
String name The name of the project. Must not be null.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
setNewProperty
public void setNewProperty ( String name, String value )
Set a property if no value currently exists. If the property exists already, a message is logged and the method returns with no other effect.
Since: 1.5
Parameters
TypeNameDescription
String name The name of property to set. Must not be null.
String value The new value of the property. Must not be null.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
setProjectReference
public void setProjectReference ( Object obj )
Set a reference to this Project on the parameterized object. Need to set the project before other set/add elements are called.
Parameters
TypeNameDescription
Object obj the object to invoke setProject(this) on.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
setProperty
public void setProperty ( String name, String value )
Set a property. Any existing property of the same name is overwritten, unless it is a user property.
Parameters
TypeNameDescription
String name The name of property to set. Must not be null.
String value The new value of the property. Must not be null.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
setSystemProperties
public void setSystemProperties ( )
Add all system properties which aren't already defined as user properties to the project properties.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
setUserProperty
public void setUserProperty ( String name, String value )
Set a user property, which cannot be overwritten by set/unset property calls. Any previous value is overwritten.
Parameters
TypeNameDescription
String name The name of property to set. Must not be null.
String value The new value of the property. Must not be null.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
toBoolean
public static boolean toBoolean ( String s )
Return the boolean equivalent of a string, which is considered true if either "on", "true", or "yes" is found, ignoring case.
Parameters
TypeNameDescription
String s The string to convert to a boolean value.
Wiki javadoc Use textile entry format.
Add your comments here.
topoSort
public Vector topoSort ( String root, Hashtable targets )
Topologically sort a set of targets. Equivalent to calling topoSort(new String[] {root}, targets, true).
Parameters
TypeNameDescription
String root The name of the root target. The sort is created in such a way that the sequence of Targets up to the root target is the minimum possible such sequence. Must not be null.
Hashtable targets A Hashtable mapping names to Targets. Must not be null.
Exceptions
BuildException if there is a cyclic dependency among the targets, or if a named target does not exist.
Wiki javadoc Use textile entry format.
Add your comments here.
topoSort
public Vector topoSort ( String root, Hashtable targets, boolean returnAll )
Topologically sort a set of targets. Equivalent to calling topoSort(new String[] {root}, targets, returnAll).
Since: Ant 1.6.3
Parameters
TypeNameDescription
String root The name of the root target. The sort is created in such a way that the sequence of Targets up to the root target is the minimum possible such sequence. Must not be null.
Hashtable targets A Hashtable mapping names to Targets. Must not be null.
boolean returnAll boolean indicating whether to return all targets, or the execution sequence only.
Exceptions
BuildException if there is a cyclic dependency among the targets, or if a named target does not exist.
Wiki javadoc Use textile entry format.
Add your comments here.
topoSort
public Vector topoSort ( String [] root, Hashtable targets, boolean returnAll )
Topologically sort a set of targets.
Since: Ant 1.6.3
Parameters
TypeNameDescription
String [] root String[] containing the names of the root targets. The sort is created in such a way that the ordered sequence of Targets is the minimum possible such sequence to the specified root targets. Must not be null.
Hashtable targets A map of names to targets (String to Target). Must not be null.
boolean returnAll boolean indicating whether to return all targets, or the execution sequence only.
Exceptions
BuildException if there is a cyclic dependency among the targets, or if a named target does not exist.
Wiki javadoc Use textile entry format.
Add your comments here.
translatePath
public static String translatePath ( String toProcess )
Translate a path into its native (platform specific) format.

This method uses PathTokenizer to separate the input path into its components. This handles DOS style paths in a relatively sensible way. The file separators are then converted to their platform specific versions.

Parameters
TypeNameDescription
String toProcess The path to be translated. May be null.
See also
Wiki javadoc Use textile entry format.
Add your comments here.