Class SubAnt
- All Implemented Interfaces:
- Cloneable
Use with directories
subant can be used with directory sets to execute a build from different directories. 2 different options are offered
- run the same build file /somepath/otherpath/mybuild.xml with different base directories use the genericantfile attribute
- if you want to run directory1/build.xml, directory2/build.xml, .... use the antfile attribute. The base directory does not get set by the subant task in this case, because you can specify it in each build file.
- Since:
- Ant1.6
- 
Field SummaryFields inherited from class org.apache.tools.ant.ProjectComponentdescription, location, project
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidAdds a resource collection to the implicit build path.voidAdd a target to this Ant invocation.voidAdds a directory set to the implicit build path.voidaddFilelist(FileList list) Adds an ordered file list to the implicit build path.voidaddFileset(FileSet set) Adds a file set to the implicit build path.voidCorresponds to<ant>'s nested<property>element.voidCorresponds to<ant>'s nested<propertyset>element.voidCorresponds to<ant>'s nested<reference>element.Creates a nested build path, and add it to the implicit build path.Creates a nested<buildpathelement>, and add it to the implicit build path.voidexecute()Runs the various sub-builds.protected StringGet the default build file name to use when launching the task.voidhandleErrorFlush(String output) Pass output sent to System.err to the new project.voidhandleErrorOutput(String output) Pass output sent to System.err to the new project.voidhandleFlush(String output) Pass output sent to System.out to the new project.inthandleInput(byte[] buffer, int offset, int length) Process input into the ant taskvoidhandleOutput(String output) Pass output sent to System.out to the new project.voidsetAntfile(String antfile) This method builds the file name to use in conjunction with directories.voidsetBuildpath(Path s) Set the buildpath to be used to find sub-projects.voidBuildpath to use, by reference.voidsetFailonerror(boolean failOnError) Sets whether to fail with a build exception on error, or go on.voidsetGenericAntfile(File afile) This method builds a file path to use in conjunction with directories.voidsetInheritall(boolean b) Corresponds to<ant>'sinheritallattribute.voidsetInheritrefs(boolean b) Corresponds to<ant>'sinheritrefsattribute.voidCorresponds to<ant>'soutputattribute.voidThe target to call on the different sub-builds.voidsetVerbose(boolean on) Enable/ disable verbose log messages showing when each sub-build path is entered/ exited.Methods inherited from class org.apache.tools.ant.TaskbindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskTypeMethods inherited from class org.apache.tools.ant.ProjectComponentclone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
- 
Constructor Details- 
SubAntpublic SubAnt()
 
- 
- 
Method Details- 
getDefaultBuildFileGet the default build file name to use when launching the task.This function may be overridden by providers of custom ProjectHelper so they can implement easily their sub launcher. - Returns:
- the name of the default file
- Since:
- Ant 1.8.0
 
- 
handleOutputPass output sent to System.out to the new project.- Overrides:
- handleOutputin class- Task
- Parameters:
- output- a line of output
- Since:
- Ant 1.6.2
 
- 
handleInputProcess input into the ant task- Overrides:
- handleInputin class- Task
- Parameters:
- buffer- the buffer into which data is to be read.
- offset- the offset into the buffer at which data is stored.
- length- the amount of data to read
- Returns:
- the number of bytes read
- Throws:
- IOException- if the data cannot be read
- Since:
- Ant 1.6.2
- See Also:
 
- 
handleFlushPass output sent to System.out to the new project.- Overrides:
- handleFlushin class- Task
- Parameters:
- output- The output to log. Should not be- null.
- Since:
- Ant 1.6.2
 
- 
handleErrorOutputPass output sent to System.err to the new project.- Overrides:
- handleErrorOutputin class- Task
- Parameters:
- output- The error output to log. Should not be- null.
- Since:
- Ant 1.6.2
 
- 
handleErrorFlushPass output sent to System.err to the new project.- Overrides:
- handleErrorFlushin class- Task
- Parameters:
- output- The error output to log. Should not be- null.
- Since:
- Ant 1.6.2
 
- 
execute
- 
setAntfileThis method builds the file name to use in conjunction with directories.Defaults to "build.xml". If genericantfileis set, this attribute is ignored.- Parameters:
- antfile- the short build file name. Defaults to "build.xml".
 
- 
setGenericAntfileThis method builds a file path to use in conjunction with directories.Use If this attribute is set,genericantfile, in order to run the same build file with different basedirs.antfileis ignored.- Parameters:
- afile- (path of the generic ant file, absolute or relative to project base directory)
 
- 
setFailonerrorpublic void setFailonerror(boolean failOnError) Sets whether to fail with a build exception on error, or go on.- Parameters:
- failOnError- the new value for this boolean flag.
 
- 
setTargetThe target to call on the different sub-builds. Set to "" to execute the default target.- Parameters:
- target- the target
 
- 
addConfiguredTargetAdd a target to this Ant invocation.- Parameters:
- t- the- TargetElementto add.
- Since:
- Ant 1.7
 
- 
setVerbosepublic void setVerbose(boolean on) Enable/ disable verbose log messages showing when each sub-build path is entered/ exited. The default value is "false".- Parameters:
- on- true to enable verbose mode, false otherwise (default).
 
- 
setOutputCorresponds to<ant>'soutputattribute.- Parameters:
- s- the filename to write the output to.
 
- 
setInheritallpublic void setInheritall(boolean b) Corresponds to<ant>'sinheritallattribute.- Parameters:
- b- the new value for this boolean flag.
 
- 
setInheritrefspublic void setInheritrefs(boolean b) Corresponds to<ant>'sinheritrefsattribute.- Parameters:
- b- the new value for this boolean flag.
 
- 
addPropertyCorresponds to<ant>'s nested<property>element.- Parameters:
- p- the property to pass on explicitly to the sub-build.
 
- 
addReferenceCorresponds to<ant>'s nested<reference>element.- Parameters:
- r- the reference to pass on explicitly to the sub-build.
 
- 
addPropertysetCorresponds to<ant>'s nested<propertyset>element.- Parameters:
- ps- the propertyset
 
- 
addDirsetAdds a directory set to the implicit build path.Note that the directories will be added to the build path in no particular order, so if order is significant, one should use a file list instead! - Parameters:
- set- the directory set to add.
 
- 
addFilesetAdds a file set to the implicit build path.Note that the directories will be added to the build path in no particular order, so if order is significant, one should use a file list instead! - Parameters:
- set- the file set to add.
 
- 
addFilelistAdds an ordered file list to the implicit build path.Note that contrary to file and directory sets, file lists can reference non-existent files or directories! - Parameters:
- list- the file list to add.
 
- 
addAdds a resource collection to the implicit build path.- Parameters:
- rc- the resource collection to add.
- Since:
- Ant 1.7
 
- 
setBuildpathSet the buildpath to be used to find sub-projects.- Parameters:
- s- an Ant Path object containing the buildpath.
 
- 
createBuildpathCreates a nested build path, and add it to the implicit build path.- Returns:
- the newly created nested build path.
 
- 
createBuildpathElementCreates a nested<buildpathelement>, and add it to the implicit build path.- Returns:
- the newly created nested build path element.
 
- 
setBuildpathRefBuildpath to use, by reference.- Parameters:
- r- a reference to an Ant Path object containing the buildpath.
 
 
-