what-is-ant-and-how-can-one-configure?
Thursday, 2 June 2011
ANT is a Java based build tool and helps in automating whole of build process of a Java project.
ANT uses an XML build file and by default it looks for a build file named build.xml from the directory it has been executed.
A build.xml contains several targets e.g. creating or deleting directory structure, post compilation creation of jar or ear files, extracting/unzipping jar/ear files etc.One target can depend upon one or more targets and it can contain one or more tasks.
One can download Apace Ant 1.7.1 from here.Once that is done, extract it any of your local drive. Set the system variables as follows:
ANT_HOME =D:\apache-ant-1.7.1 (Here I have extracted the ANT ZIP at D drive)
PATH = %ANT_HOME%\bin
To ensure proper installation of ANT, go to command prompt and execute the command "ant - version", you will see the installed ant version.
The execution of ANT file is done from the directory where build.xml resides and simply typing ant command on console and hit enter will start the execution of build file.
The build.xml looks like as given below:
In the build.xml,
The other target element 'compress' is dependent upon compile target element. It creates a jar file which includes all the .class files in current directory.
The echo tasks just display messages on console.
0 comments:
Post a Comment