Archive

Posts Tagged ‘Apache Ant’

Ant Primer

September 12, 2009 Leave a comment

 

 

apache ant 

 

Ant Origin:

Ant was conceived by James Duncan Davidson while turning a product from Sun into open source. That product, Sun’s reference JSP/Servlet engine, later became Apache Tomcat. A proprietary version of Make was 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 platform-independent tool to build Tomcat from directives in an XML “build file”. From this humble beginning, the tool has gone on to become more widespread than the Tomcat product for which it was created. Ant (version 1.1) was officially released as a stand-alone product on July 19, 2000. Today, Ant is the build tool used by most Java development projects. Most open source developers include build.xml files with their distribution.

 

Ant Introduction:

In recent years, Open Source tool Ant has become the de facto standard for building Java projects. Like its venerable ancestor Make, Ant controls the steps necessary to compile, package, and arrange the files that make up your development project. Built with Java, Ant has been designed to be easy to use, flexible, and platform independent.

Apache Ant is an Apache Jakarta project. It is open source software, and is released under the Apache Software License. It is a java-based tool for automating software build processes. It is similar to Make but is implemented using the Java language, requires the Java platform, and is best suited to building Java projects. The most immediately noticeable difference between Ant and Make is that, Ant uses XML to describe the build process and its dependencies, whereas Make has its Makefile format. By default the XML file is named build.xml.

All modern Java IDEs integrate with it, most open-source Java projects use it. If you are developing Java software and not using Ant, then chances are you’re doing things the hard way. It’s relatively easy to craft an Ant build file by cutting and pasting pieces from other build files, but we don’t want to get into a situation where maintaining the build process is a full-time job. It is important to understand Ant’s capabilities in order to avoid hacking build files. By understanding Ant’s basic data types, syntax, and properties and applying some simple best practice techniques, the build process can be easily controlled, extended, and reused.

ANT enables you to automate the build deploy process of your server-side Java Web components as well, such as custom tags, servlets, and JSPs. Ant gets its cross-platform support by relying on Java for file access, compilation, and other tasks. Ant is extensible through its support for scripting (Jython and NetRexx, among others), Java custom tasks, and the ability to call OS commands, executables, and shell scripts via an Ant exec task (normally a lastresort measure). Ant makes continuous integration possible for server-side components with its automated build script and integration with JUnit, a unit-testing framework for Java. Read more…

Advertisements

Ant Installation & Configuration

  

  

At the time of this post, the latest stable version available form Apache is 1.7. Older releases of Ant can be found here. Old releases are only provided as zip archives that can be extracted by jar xf archive.zip. Its highly recommend to not use old releases but upgrade to Ant’s latest release.

Ant 1.5.4 is the last release that supports JDK 1.1, Ant 1.6.0 onwards requires JDK 1.2 or later. There will be no other compatibility issues with Java versions otherwise. Current version of Ant i.e., 1.7, requires JDK version 1.2 or later, 1.5 or later is strongly recommended. Latest the version of Java is, the more Ant tasks you get. If a JDK is not present, and only JRE is present, then many tasks will not work.

  

Follow the steps below to download, install and configure Ant : Read more…