In this case ant first executes t2 and then t1 because of the dependency.Ĭommonly used attributes of target elements:ī. If a target depends on other one or more targets then ant will automatically executes the dependent targets.Įxample: If a target t1 depends on target t2 and ant instructed to executed t1. You create (or use) tasks to compile, test and assemble your source to get some kind of artifact. In this case, it is c:\apache-ant-1.10.12-bin folder. Create a new environment variable called ANTHOME that points to the Ant installation folder.
A target can be dependent on other target. Download the binaries from Unzip the zip file to a convenient location c:\folder by using Winzip, winRAR, 7-zip or similar tools. Target:Ī target is used to group the tasks and can be run directly via ant. path: It creates a classpath container which can be used later. mkdir: It creates the specified directory structure.ġ1. sql: It executes the specified sql statements.ġ0. javadoc: It generates the code documentation.ĩ. echo: It prints the text to the System.out or to a file.Ĩ. junit: It runs the junit test cases from the junit framework.ħ. javac: It compiles the specified source code.Ħ. : It specifies the java version which is used by ant. : It specifies the ant jar file location.ħ. ant.home: It specifies the home directory of apache ant installation.Ħ. : It specifies the name of the project.ĥ. basedir: It specifies the base directory of the build.Ĥ. ant.version: It specifies the installed ant version.ģ. ant.file: It specifies the build file location.Ģ. The value of the property can be accessed using $.ġ. A property can be read from a file or a classpath resource using file and resource attributes respectively. Property element is used to define the properties like project name, project source directory etc. basedir: It specifies the base directory of the project. default: It specifies the default target for the build script.Ĭ. name: It specifies the name of the project.ī. A project element has the following attributes:Ī. It is the root element of the build.xml file. Commonly used elements of ant build file: 1.