This article explains how to write very basic ANT . This does not explain indepth knowledge on building your project using ANT . But, this writeup will be more useful for the beginners who haben't writen any ANT before. Before start writing the , lets look into how to install the ANT in your machine.
Install Apache Ant
Download the Apache Ant from the link : Download Apache Ant
- Unzip the files into your machine.
- Set your system path variable to ANT's bin directory. For example d:/projects/ant/bin"
- Set the ANT_HOME in your system variables. ANT_HOME should point to your Ant installation directory. For example "d:/projects/ant".
- Set JAVA_HOME in your system environment variables.
- Copy tools.jar file into the "JRE/lib" folder.
Buildfile: .xml does not exist! failed Set up is done. Let's look into our first simple example program using ANT .This example program shows how to create the JAR file after building all the java files.
In the above code "sampleProject" is the project name for this prticular . We are setting base directory as the current directory by just giving .(dot). We are telling the to start from "jar" target name. The default attribute is used for setting the starting point for the ANT.We call seperate task as target. We can define as many number of targets inside file. If we closely look into the file, we have many number of targets based its operations. So, our starts with "jar" target.
Target has depends attribute to indicate, that particular task can be executed only after the certain number of dependencies. In our case, before building the jar file, we have to compile the files. So, jar target calls compile target. That has some dependencies that is executed. Once the is successful, test.jar will be created in the same directory.
.xml
No comments:
Post a Comment