Apache Ant Projects

Apache Ant uses XML to write buildfiles and each buildfile contains one project and at least one default target. Target is a container of tasks and each task is a code that can be executed. We can understand to a project as a container that wraps targets and tasks into a single unit. To create a project, we can use <project> tag. For example, a project tag would look like below:

And it comprises both target and tasks too. So can be written as:

Project tag uses various attributes to set the name and target to run. The most commonly used attributes are given below.

Apache Ant Project Attributes

AttributeDescriptionRequired
nameIt is a name of the projectNo
defaultIt is used to set default target if no target is supplied explicitly.No
basedirIt requires base directory pathNo

Note: We can select which target to be executed. If target is not given project's default is used.





Latest Courses