Class AntFetch

  • All Implemented Interfaces:
    java.lang.Cloneable

    public class AntFetch
    extends org.apache.tools.ant.Task
    Identical (copy and paste, even) to the 'Ant' task, with the exception that properties from the new project can be copied back into the original project. 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 Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  AntFetch.Reference
      Helper class that implements the nested <reference> element of <ant> and <antcall>.
    • Field Summary

      • Fields inherited from class org.apache.tools.ant.Task

        taskName, taskType, wrapper
      • Fields inherited from class org.apache.tools.ant.ProjectComponent

        description, location, project
    • Constructor Summary

      Constructors 
      Constructor Description
      AntFetch()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addReference​(AntFetch.Reference r)
      Reference element identifying a data type to carry over to the new project.
      org.apache.tools.ant.taskdefs.Property createProperty()
      Property to pass to the new project.
      void execute()
      Do the execution.
      protected void handleErrorOutput​(java.lang.String line)
      Pass output sent to System.err to the new project.
      protected void handleOutput​(java.lang.String line)
      Pass output sent to System.out to the new project.
      void init()
      Creates a Project instance for the project to call.
      void setAntfile​(java.lang.String s)
      The build file to use.
      void setDir​(java.io.File d)
      The directory to use as a base directory for the new Ant project.
      void setInheritAll​(boolean value)
      If true, pass all properties to the new Ant project.
      void setInheritRefs​(boolean value)
      If true, pass all references to the new Ant project.
      void setOutput​(java.lang.String s)
      Filename to write the output to.
      void setReturn​(java.lang.String r)
      Set the property or properties that are set in the new project to be transfered back to the original project.
      void setTarget​(java.lang.String s)
      The target of the new Ant project to execute.
      • Methods inherited from class org.apache.tools.ant.Task

        bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleFlush, handleInput, 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, setProject
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AntFetch

        public AntFetch()
    • Method Detail

      • setInheritAll

        public void setInheritAll​(boolean value)
        If true, pass all properties to the new Ant project. Defaults to true.
        Parameters:
        value - The new inheritAll value
      • setInheritRefs

        public void setInheritRefs​(boolean value)
        If true, pass all references to the new Ant project. Defaults to false.
        Parameters:
        value - The new inheritRefs value
      • init

        public void init()
        Creates a Project instance for the project to call.
        Overrides:
        init in class org.apache.tools.ant.Task
      • handleOutput

        protected void handleOutput​(java.lang.String line)
        Pass output sent to System.out to the new project.
        Overrides:
        handleOutput in class org.apache.tools.ant.Task
        Parameters:
        line - Description of the Parameter
        Since:
        Ant 1.5
      • handleErrorOutput

        protected void handleErrorOutput​(java.lang.String line)
        Pass output sent to System.err to the new project.
        Overrides:
        handleErrorOutput in class org.apache.tools.ant.Task
        Parameters:
        line - Description of the Parameter
        Since:
        Ant 1.5
      • execute

        public void execute()
                     throws org.apache.tools.ant.BuildException
        Do the execution.
        Overrides:
        execute in class org.apache.tools.ant.Task
        Throws:
        org.apache.tools.ant.BuildException - Description of the Exception
      • setDir

        public void setDir​(java.io.File d)
        The 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:
        d - The new dir value
      • setAntfile

        public void setAntfile​(java.lang.String s)
        The build file to use. Defaults to "build.xml". This file is expected to be a filename relative to the dir attribute given.
        Parameters:
        s - The new antfile value
      • setTarget

        public void setTarget​(java.lang.String s)
        The target of the new Ant project to execute. Defaults to the new project's default target.
        Parameters:
        s - The new target value
      • setOutput

        public void setOutput​(java.lang.String s)
        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:
        s - The new output value
      • createProperty

        public org.apache.tools.ant.taskdefs.Property createProperty()
        Property to pass to the new project. The property is passed as a 'user property'
        Returns:
        Description of the Return Value
      • setReturn

        public void setReturn​(java.lang.String r)
        Set the property or properties that are set in the new project to be transfered back to the original project. As with all properties, if the property already exists in the original project, it will not be overridden by a different value from the new project.
        Parameters:
        r - the name of a property in the new project to set in the original project. This may be a comma separate list of properties.
      • addReference

        public void addReference​(AntFetch.Reference r)
        Reference element identifying a data type to carry over to the new project.
        Parameters:
        r - The feature to be added to the Reference attribute