ImportAnt 5.5.3

A set of reusable Apache Ant targets.
LGPL (GNU Lesser General Public License) 
Miguel Pardal
ROOT \ Programming \ Compilers
ImportAnt is a set of reusable Apache Ant targets with the goal to standardize project build files avoiding excessive redundancy.

Before we can describe what ImportAnt does, we'll summarize how Apache Ant works.

Ant is a build tool, similar in goal to Make. It is based on the Java platform, so it's independent of the underlying operating system. A typical Ant project has a set of Java classes and a build file (by default called, build.xml). Ant has a task set that can perform actions such as: file management (create, copy, delete), java tools (java compiler, java virtual machine), database operations, source code management (cvs), etc. Each Ant build file defines a set of targets for a project that perform tasks and are parametrized by properties. For the same project type, the build files are mostly identic.

ImportAnt is a set of reusable Apache Ant targets. The goal of ImportAnt is to standardize multiple project build files and avoid excessive redundancy.

ImportAnt was started in 2004 as a helper library for a Distributed Systems college course, whose project was developed for a +300 student group. These student projects have several types of applications: console based, libraries, web applications and web services.

Since 2004, ImportAnt has been used by a population of +300 students each year, and has proved to be a very useful sidekick to Apache Ant, enabling the development, testing and deployment of hundreds of applications.

The submission of ImportAnt to SourceForge aims to share these benefits with a broader community, receiving feedback and additional modules that can help Java developers worldwide to focus more on the coding and testing, and less on the build files.

Project's directory structure

The following show how to organize directories and files for a project using ImportAnt:

* project directories - Overall description of ImportAnt's directory structure
* web project directories - Required directory structure for a web application project
* 3 level project directories - Required directory structure for a 3 level project


The main concept in ImportAnt is the module. Each module is like a fragment of a project build file. The fragments are imported into the project build file to extend its capabilities, depending on the type of project.

The ImportAnt modules are stored in a directory, ex. ../import-ant. Some of the modules are: core.xml, console-app.xml, library.xml Each module contains definitions for Ant targets, properties and classpaths.

Let's assume a console-based application project called MyApp. This project has a directory containing its source code and a build.xml file. The ./MyApp/build.xml file imports ../import-ant/core.xml and ../import-ant/console-app.xml The ./MyApp/build.xml must define compile.classpath, run.classpath, run.main-class and run.args. The ./MyApp/build.xml must define a build target, that depends on build-console-app. After this simple customization steps, the build file supports the following useful targets (among others): ant clean - delete temporary build files ant compile - compile source code ant run - execute main class All the target definitions are imported from the modules and are fully customizable.

Another application - MyOtherApp - just has to specify a diferent customization. This way, each build file only contains what differs from project to project. The common definitions are inside the reusable module and are not replicated.

Now let's suppose another project: MyLib. In this case the ./MyLib/build.xml imports core.xml and library.xml and defines build target depending on build-library. Now the project can be built and a JAR file is created.

Modules also exist for database initialization, web applications (based on Java Servlets and JSPs), xml data-binding (JAX-B), web services (JAX-WS). New modules can easily be created to support different project types or projects with specific configuration needs.

The following diagram (see legend) shows all current ImportAnt modules and the relationships between them; It is a good starting point to understanding ImportAnt's source code.

It is an open-source project, released under the GNU LGPL license.

Last updated on October 6th, 2008

#Apache Ant #standardize project build #Apache #Ant #target #builder

  Add it to your Download Basket!

 Add it to your Watch List!


Rate it!

What's new in ImportAnt 5.5.3:

  • Stabilization release:
  • tested for JWSDP 2.0 and Glassfish V2 running on Java 5
  • release version used with version 1.0 of the STEP Framework (
Read full changelog
send us
an update

Add your review!