# Appendix E: Project Components

This file will give you a quick introduction and a reference of the things that you may see in a build files besides tasks and types.

## Phing Projects

Projects are the outermost container for everything in build files. The <project> tag also is the root tag in build files. It contains the name, the directory, a short description and a default target.

Project may contain task calls and targets (see below).

### Example

    <?xml version="1.0" ?>

    <project name="TestProject" basedir="." default="main"
             description="This is a test project to show how to use projects ;-)">

      <!-- Everything else goes here -->

    </project>

### Attributes

Name | Type | Description | Default | Required
--- | --- | --- | --- | ---
basedir | String | The base directory of the project, i.e. the directory all paths are relative to. | n/a | Yes
default | String | The name of the target that is executed if none is explicitely specified when calling Phing | all | No
description | String | A free text description of the project | n/a | No
name | String | Name of the project | n/a | Yes

## Targets

### Example

    <target if="lang" unless="lang.en" depends="foo1,foo2"
           name="main" description="This is an example target" >

      <!-- everything else goes here -->

    </target>

The target defined in the example above is only executed, if the property ${lang} is set and the property ${lang.en} is not set. Additionally, id depends on the targets foo1 and foo2. That means, the targets foo1 and foo2 are executed before the target main is executed. The name of the target is main and it also has a description.

### Attributes

Name | Type | Description | Default | Required
--- | --- | --- | --- | ---
depends | String | One or more names of targets that have to be executed before this target can be executed. | n/a | No
description | String | A free text description of the target. | n/a | No
if | String | The name of the property that is to be set if the target is to be executed. | n/a | No
name | String | The name of the target | n/a | Yes
unless | String | The name of the property that is to be set if the target is not to be executed. | n/a | No