Package org.apache.tools.ant.taskdefs
Class Ant
java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.apache.tools.ant.taskdefs.Ant
- All Implemented Interfaces:
- Cloneable
Build a sub-project.
  
  <target name="foo" depends="init">
    <ant antfile="build.xml" target="bar" >
      <property name="property1" value="aaaaa" />
      <property name="foo" value="baz" />
    </ant>
  </target>
  <target name="bar" depends="init">
    <echo message="prop is ${property1} ${foo}" />
  </target>
 - Since:
- Ant 1.1
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classHelper class that implements the nested <reference> element of <ant> and <antcall>.static classHelper class that implements the nested <target> element of <ant> and <antcall>.
- 
Field SummaryFields inherited from class org.apache.tools.ant.ProjectComponentdescription, location, project
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidAdd a target to this Ant invocation.voidAdd a set of properties to pass to the new project.voidAdd a Reference element identifying a data type to carry over to the new project.Property to pass to the new project.voidexecute()Do the execution.protected StringGet the default build file name to use when launching the task.protected ProjectGet the (sub)-Project instance currently in use.voidhandleErrorFlush(String errorOutputToFlush) Handle error output.voidhandleErrorOutput(String errorOutputToHandle) Handle error output.voidhandleFlush(String toFlush) Handles output.inthandleInput(byte[] buffer, int offset, int length) Handles input.voidhandleOutput(String outputToHandle) Handles output.voidinit()Creates a Project instance for the project to call.voidsetAntfile(String antFile) The build file to use.voidThe directory to use as a base directory for the new Ant project.voidsetInheritAll(boolean value) If true, pass all properties to the new Ant project.voidsetInheritRefs(boolean value) If true, pass all references to the new Ant project.voidSet the filename to write the output to.voidThe target of the new Ant project to execute.voidsetUseNativeBasedir(boolean b) Whether the basedir of the new project should be the same one as it would be when running the build file directly - independent of dir and/or inheritAll settings.Methods inherited from class org.apache.tools.ant.TaskbindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, 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- 
Antpublic Ant()simple constructor
- 
Antcreate a task bound to its creator- Parameters:
- owner- owning task
 
 
- 
- 
Method Details- 
setUseNativeBasedirpublic void setUseNativeBasedir(boolean b) Whether the basedir of the new project should be the same one as it would be when running the build file directly - independent of dir and/or inheritAll settings.- Parameters:
- b- boolean
- Since:
- Ant 1.8.0
 
- 
setInheritAllpublic void setInheritAll(boolean value) If true, pass all properties to the new Ant project. Defaults to true.- Parameters:
- value- if true pass all properties to the new Ant project.
 
- 
setInheritRefspublic void setInheritRefs(boolean value) If true, pass all references to the new Ant project. Defaults to false.- Parameters:
- value- if true, pass all references to the new Ant project
 
- 
initpublic void init()Creates a Project instance for the project to call.
- 
handleOutputHandles output. Send it the the new project if is present, otherwise call the super class.- Overrides:
- handleOutputin class- Task
- Parameters:
- outputToHandle- The string output to output.
- Since:
- Ant 1.5
- See Also:
 
- 
handleInputHandles input. Delegate to the created project, if present, otherwise call the super class.- 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
- See Also:
 
- 
handleFlushHandles output. Send it the the new project if is present, otherwise call the super class.- Overrides:
- handleFlushin class- Task
- Parameters:
- toFlush- The string to output.
- Since:
- Ant 1.5.2
- See Also:
 
- 
handleErrorOutputHandle error output. Send it the the new project if is present, otherwise call the super class.- Overrides:
- handleErrorOutputin class- Task
- Parameters:
- errorOutputToHandle- The string to output.
- Since:
- Ant 1.5
- See Also:
 
- 
handleErrorFlushHandle error output. Send it the the new project if is present, otherwise call the super class.- Overrides:
- handleErrorFlushin class- Task
- Parameters:
- errorOutputToFlush- The string to output.
- Since:
- Ant 1.5.2
- See Also:
 
- 
executeDo the execution.- Overrides:
- executein class- Task
- Throws:
- BuildException- if a target tries to call itself; probably also if a BuildException is thrown by the new project.
 
- 
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 easily implement their sublauncher. - Returns:
- the name of the default file
- Since:
- Ant 1.8.0
 
- 
setDirThe directory to use as a base directory for the new Ant project. Defaults to the current project's basedir, unless inheritall has been set to false, in which case it doesn't have a default value. This will override the basedir setting of the called project.- Parameters:
- dir- new directory as- File.
 
- 
setAntfileThe build file to use. Defaults to "build.xml". This file is expected to be a filename relative to the dir attribute given.- Parameters:
- antFile- the- Stringbuild file name.
 
- 
setTargetThe target of the new Ant project to execute. Defaults to the new project's default target.- Parameters:
- targetToAdd- the name of the target to invoke.
 
- 
setOutputSet the filename to write the output to. This is relative to the value of the dir attribute if it has been set or to the base directory of the current project otherwise.- Parameters:
- outputFile- the name of the file to which the output should go.
 
- 
createPropertyProperty to pass to the new project. The property is passed as a 'user property'.- Returns:
- the created Propertyobject.
 
- 
addReferenceAdd a Reference element identifying a data type to carry over to the new project.- Parameters:
- ref-- Referenceto add.
 
- 
addConfiguredTargetAdd a target to this Ant invocation.- Parameters:
- t- the- TargetElementto add.
- Since:
- Ant 1.6.3
 
- 
addPropertysetAdd a set of properties to pass to the new project.- Parameters:
- ps-- PropertySetto add.
- Since:
- Ant 1.6
 
- 
getNewProjectGet the (sub)-Project instance currently in use.- Returns:
- Project
- Since:
- Ant 1.7
 
 
-