B.40 PhingTask

This task calls another build file. You may specify the target that is to be called within the build file. Additionally, the <phing> Tag may contain <property> Tags (see Section B.48, “PropertyTask”), <fileset> Tags (seeSection D.4, “FileSet”) or <reference> Tags.

Table B.41: Attributes

NameTypeDescriptionDefaultRequired
inheritAll Boolean If true, pass all properties to the new phing project. true No
inheritRefs Boolean If true, pass all references to the new phing project. false No
dir String The directory to use as a base directory for the new phing project. Default is 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. n/aNo
phingFile String The build file to use. Defaults to "build.xml". This file is expected to be a filename relative to the dir attribute given. n/aYes
target String The target of the new Phing project to execute. Default is the new project's default target. n/aNo
haltonfailure Boolean If true, fail the build process when the called build fails false No
output String Filename to write the Phing output to. This is relative to the value of the dir attribute if it has been set or to the basedir of the current project otherwise. n/aNo
usenativebasedir Boolean If set to "true", the child build will use the same basedir as it would have used when run from the command line (i.e. the basedir one would expect when looking at the child build's buildfile). false No

B.40.1 Examples

<!-- Call target "xslttest" from buildfile "alternativebuildfile.xml" -->
<phing phingfile="alternativebuild.xml" inheritRefs="true" target="xslttest" />

<!-- Do a more complex call -->
<phing phingfile="somebuild.xml" target="sometarget">
    <property name="foo" value="bar" />
    <property name="anotherone" value="32" />
</phing>
        

B.40.2 Supported Nested Tags

B.40.3 Base directory of the new project

The base directory of the new project is set dependent on the dir and the inheritAll attribute. This is important to keep in mind or else you might run into bugs in your build.xml's. The following table shows when which value is used:

Table B.42: How attributes are used

dir inheritAll new project's basedir
value provided true value of dir attribute
value provided false value of dir attribute
omitted true basedir of calling task (the build file containing the <phing> call.
omitted false basedir attribute of the <project> element of the new project.