Resolving Files Against the Imported File

Suppose your main build file called importing.xml imports a build file imported.xml , located anywhere on the file system, and imported.xml reads a set of properties from imported.properties :

<!-- importing.xml -->
<project name="importing" basedir="." default="...">
  <import file="${path_to_imported}/imported.xml"/>
</project>

<!-- imported.xml -->
<project name="imported" basedir="." default="...">
  <property file="imported.properties"/>
</project>

This snippet however will resolve imported.properties against the basedir of importing.xml , because the basedir of imported.xml is ignored by Phing. The right way to use imported.properties is:

<!-- imported.xml -->
<project name="imported" basedir="." default="...">
  <property file="${phing.file.imported}/imported.properties"/>
</project>

As explained above ${phing.file.imported} stores the full path of the build script, that defines the project called imported, (in short it stores the path to imported.xml) and ${phing.dir.imported} stores its directory. This technique also allows imported.xml to be used as a standalone file (without being imported in other project).