Apache Ant

Ant is a software tool for automating software build processes. It is similar to Make but is written in the Java language and is primarily intended for use with Java. The most immediately noticeable difference between Ant and Make is that Ant uses a file in XML format to describe the build process and its dependencies, whereas Make has its own Makefile format. By default the XML file is named build.xml. Ant is one of the Apache projects.

Sample build.xml file

Below is listed a sample build.xml file for a simple Java "Hello, world" application. It defines three targets - clean, compile and jar each of which has an associated description. The jar target lists the compile target as a dependency. This tells Ant that before it can start the jar target it must first complete the compile target. Within each target are the actions that Ant must take to build that target. For example, to build the compile target Ant must first create a directory called classes (Ant will only do so if it does not already exist) and then invoke the Java compiler.
                                                                                                                                                         

Portability

One of the primary aims of Ant was to solve Make's portability problems. In a Makefile the actions required to create a target are specified as shell commands which are specific to the current platform, usually a Unix shell. Ant solves this problem by providing a large amount of built-in functionality which it can then guarantee will behave identically on all platforms. For example, in the sample build.xml file above the clean target deletes the classes directory and everything in it. In a Makefile this would typically be done with the command:
  rm -rf classes/ 
rm is a Unix specific command which will probably not be available if the Makefile is used in a non-Unix environment such as Microsoft Windows. In an Ant build file the same thing would be accomplished using a built in command:
   
A common discrepency between different platforms is the way in which directory paths are specified. Unix uses a forward slash (/) to delimit the components of a path, whereas Windows uses a backslash (\). Ant build files always use the Unix convention, forward slashes, and then convert path specifiers to the appropriate format for the current platform.

History

Ant was invented by James Duncan Davidson while turning a product from Sun into open source. The product later became Jakarta Tomcat; it was Sun's reference JSP/Servlet engine. While closed source, Make could be used to build it on the Solaris Operating Environment, but in the open source world, there was no way of controlling which platform was used to build Tomcat. Ant was created as a simple tool to take an XML "build file" and use it to build Tomcat, regardless of which platform the developer was using. From this humble beginning, the tool has gone on to become more ubiquitous -and perhaps successful- than the Tomcat product for which it was created. It has proven to become the underpinning of open source Java; developers expect a "build.xml" file with every project. Because it makes it trivial to integrate JUnit tests with the build process, Ant has made it easy for willing developers to adopt test-driven development, and even Extreme Programming. Its sole potential competitor is currently Maven.

See also

References

External links

 

<< PreviousWord BrowserNext >>
marquess of ailesbury
openssl
marquess of ailsa
marquess of abergavenny
marquess of linlithgow
marquess of milford haven
ramn valds
riverside (house)
marquess of reading
george herbert walker
1851 in science
fire marshal
1733 in science
1725 in science
1738 in science
emperor jianwen of jin china
1890 in science
1753 in science
nephilim (role playing game)
nephilim (disambiguation)
levy jennings chart
thurso f.c.
balintore f.c.
bonar bridge f.c.
invergordon f.c.
1777 in science
jewpedia
1606 in science
1855 in science
seiyun
bob dylan (album)
grays
1799 in science
jason reso
gerald gardiner, baron gardiner
meridian lossless packing
1847 in science
mlp
scott garland
1871 in science
galena and chicago union railroad
takanohana koji
1873 in science
tony randall