concept target in category ant

appears as: Targets, target, targets, The targets, A target, The target, target
Ant in Action

This is an excerpt from Manning's book Ant in Action.

Figure 1.1 shows the Ant build file as a graph of targets, each target containing tasks. When the project is built, Ant determines which targets need to be executed, and in what order. Then it runs the tasks inside each target. If a task somehow fails, Ant halts the build. This lets simple rules such as “deploy after compiling” be described, as well as more complex ones such as “deploy only after the unit tests have succeeded.”

Figure 1.1. Conceptual view of a build file. The project encompasses a collection of targets. Inside each target are task declarations, which are statements of the actions Ant must take to build that target. Targets can state their dependencies on other targets, producing a graph of dependencies. When executing a target, all its dependents must execute first.

Ant uses XML files called build files to describe how to build a project. In the build file developers list the high-level various goals of the build—the targets—and actions to take to achieve each goal—the tasks.

<project name="core-chapter07" default="default">

<description>
  This is the core build file for chapter 7.
  </description>

<!-- we don't cover imports until chapter 10
    If you are curious, what we are doing here
    is importing every single declaration of the
    imported build file, both toplevel and targets.
-->

<import file="core-chapter-06.xml" />

<target name="ftp-init" depends="init">
  <fail unless="server">Set the "server" property!</fail>
  <property name="ftp.propfile" location="secure/${server}.properties" />
  <loadproperties srcFile="${ftp.propfile}" />
</target>