KHOA CÔNG NGHỆ THÔNG TIN – ĐẠI HỌC NÔNG LÂM TP.

HCM

APACHE ANT
LAB HANDS-ON
Nguyễn Xuân Vinh
6/8/2010

This document use for practising in Nông Lâm University

0] Status [Incomplete] Author Nguyen Xuan Vinh Approved by Comments Document History . 2010 Version [1.Date Dec 18.

Contents .

8. 2010. window. After completing this lab. It is available for download at http://ant. you have to click on the link apache-ant-1.Lab Objectives The objective of this lab is to provide an introduction on using Ant (Another Neat Tool) or (XML based scripting tool) to build Java project.1 of Ant was released on 7 May. - Not depend on platform.8.zip in .org/bindownload. you will be able to: - Understand when using Ant. you can build Ant on linux.1-bin. …) Note: <give notes if any> Prerequisites - Java XML Task 1. … without any changes in source code and folder structure.apache. Download The current version 1. - Setup. netbean.cgi Here. pack and build an java project by Ant xml based scripting file without any IDE (eclipse. ubuntu. - Compile. config and write Ant build files. Ant Setup Setp 1.

In the box that opens. You can simply .the . Next.8. After the download completes. click the "Advanced" tab to obtain the dialog box shown below. It lists two kinds of variable. Setp 2.1. Therefore.those that apply only to the current user and those that apply to the whole system. Setup enviorment variables Open Control Panel-Performance and Maintenance-System (or right-click on My Computer and choose "Properties").zip archive to download the zip file. path for the Ant directory will be C:\apache-ant-1. The figure below shows the "Environment Variables" dialog box that opens next.1 folder to the root directory of C:\ drive.8. unzip this file and install the apacheant-1. click the button "Environment Variables".

The maximum total size for all environment variables. The figure shows that the directory "C:\apache-ant-1. The next figure shows a box for editing a variable. Generally. Be sure to remember to separate directory names with a semicolon. including variable names and the "equals" sign. If you use programs in a particular directory a great deal. is 32767 characters. The box for adding a new user variable is shown below.1\bin###BOT_TEXT###quot; has been added. this is likely to be a directory that you use frequently but can be any string of less than 8192 bytes. . in this case it is the PATH variable (System Variables).scroll down the lists to see what is on your system or you can edit the lists.8. you may wish to add it to the path.

then it indicates that your installation is successful. <project/> Tags & attributes .7.1. How to generate build. open the Command Prompt and run the command C:\apache-ant-1. If the following message appears. you have to check whether the installation process is done properly or not.Setp 3. Task 2. To do this. Ant is properly installed in your system.xml file Setp 1. Verify Ant installation Now..

Each build. The project tag has only three attributes: Project Attribu te Description Requireme nt name project name not necessary default target name which called by default not necessary basedir the base directory having all path. it contain absolute path not necessary <project name="My Project" default="compile" basedir=".xml file contains only one project name and at least one target."> The project tag is used to create our project and its attributes are used to handle further processing of the project. <target/> Target Attribut e Description Requireme nt name target name necessary depends depends on another target not necessary if the name of the property that must be set in order for this target to execute. not necessary . The name attribute is used to specify the project name and the default attribute is used to specify which target will be called as default when the program will run and the basedir attribute is used to calculate the absolute path of the parent directory.

not necessary descriptio n short description about target not necessary <target name="buildWar" depends="init" description="build a war file"/> <target name="init" if="build"/> <target name="init" unless="build"/> In the target tag.unless the name of the property that must not be set in order for this target to execute.e. whether property exists or not.. then this target will be executed and unless attribute is used as like else condition whether property does not exist. name attribute is used for target name and the depends attribute is used to give sequence of target. the target will not be executed and the description attribute is used for only giving details about target. one target may depend on one or more other targets. . i. which target will execute first. The if attribute is used in case of condition.