Friday, May 9, 2014

ANT Build Tool

ANT Build Tool

Ant is a build tool which is used to create a build for a particular application. By default ant triggers build.xml. Apache Ant is a Java library and command-line tool that help building software.

Steps to download ANT and install ANT

1) Download the latest apache ant from this link     https://ant.apache.org/bindownload.cgi
     (download - .zip archive: apache-ant-.......) 
2) Extract the downloaded apache ant -> Copy the folder -> go to C:  drive and paste it.
3) Go to my computer -> right click -> properties -> advanced system setting -> environment variables -> under system variables -> search for variable 'path' and click on edit.
4)  Go to C: drive, open apache and go to till bin folder (i.e. open bin folder then copy the path) then copy the complete path.
5) Under environment variable go to end of line insert ; (semi-colon) and paste the path. Click on Ok just one time.
6) Under system variable click on new, and give the variable name as ANT_HOME. Under variable value: paste the path till parent of bin(don't open bin folder). Again click on Ok just one time.
7) Under system variable again click on new, give the variable name as JAVA_HOME. Under variable value paste the path till the parent of bin folder of JDK. (from Program Files(x86) or Program Files).
8) Click on 3 times ok.
9) To confirm ANT is installed or not, go to cmd and type -> ant -version
You will get something like depends on your version-> Apache Ant(TM) version 1.9.3 compiled on December 23 2013



10) Now you have done with the installation, so lets go to use it now.

How to use ANT tool

1) Write the build.xml inside the project (for example take this project- LinkedIN_Project_By_POM).
Note- Only change the project name as your project name in the above given build.xml and directly you can use the same.

Below is the snap shot of project-



2) Open cmd and give the path of build.xml
3) Type ant and hit enter.



4) It will create a folder inside project as build and run all the test cases and will give the report in cmd screen.

2 comments: