| Table of Contents |
To eliminate the limitations of the older versions of Ant, Ant 2.x versions are being developed. Ant 2.x versions will simplify and enhance the functioning of Ant using Application Programming Interfaces (APIs). For example, the installation process of Ant 2.x versions consists of processes, such as Webstart and self-extracting jar files, to simplify the installation of Ant. Ant 2.x versions are simplified by:
Removing the magic properties that are set in the buildfile but not explicitly used in any target or task.
Removing dependencies on native script.
Providing the clean object model. This feature allows you to treat project, targets, and tasks as objects.
Providing an event model that integrates with Integrated Development Environments (IDEs) and Graphical User Interfaces (GUIs)
Using a consistent naming scheme for all tasks.
Keeping the syntax of build scripts compatible with Ant 1.x versions.
Keeping the interfaces of tasks similar to that of Ant 1.x versions.
Providing the capability to halt the build process of buildfiles.
Ant 2.x versions extend the <taskdef> task of Ant 1.x versions by packaging the tasks into task libraries along with data types and other utilities. The task libraries are JavaTM Archive (JAR) archives that describe the contained tasks to Ant 2.x versions. These versions will automatically detect the tasks contained in the task library that will allow you to use these tasks in the buildfile explicitly.
Ant 2.x versions extract the functions that are common to the tasks and redirect them to utility classes to provide a tested and stable framework. The core of Ant 2.x versions is based on the object model of task, target, and project and is independent of external references.
Ant tasks are extensible Java classes. As a result, you can extend the functioning of Ant tasks by adding new Java classes. Ant 2.x versions contain new tasks that extend the scope of Ant.
The new tasks are:
A task to obfuscate class files. Obfuscating is a means of encoding classes in a way that makes it difficult to understand them after decompilation.
A task to create Red Hat Package Managers (RPMs).
A task to compile Java Server Pages (JSP).
A task to create XML Metadata Interchange (XMI) from Java.
A task to split files. This task divides the file into header, body, and tail.
A task for network URLs to provide remote application building.
A task to extract classes from a JAR file on which a class depends.
A spider task that verifies links for lost data or server errors.
A <condition> task that helps to conditionally set the property value. If the condition is true, the property will be set; else, it will not be set. The <condition> task is a combination of the <available> task and the <uptodate> task.
A task to locate buildfiles according to a fileset data type and invoke a common target in them.
Ant 2.x versions provide the following features that enhance the functioning of older versions:
Execute the build process dynamically using SYSTEM XML entities. This dynamic feature enables you to initiate a task at run time. This feature also allows you to reassign property values using built-in tasks.
Provide the capability to add XML files to a buildfile and reuse portions of XML, such as targets, tasks, and paths.
Allow you to halt the running of the build process. This helps debug the application when you encounter an error in the middle of the build process.
Allow the direct flow of the Ant error messages to the front-end through well-defined Application Programming Interface (API) by completely detaching from the system.err/.out/.in file. The front-end handles end user inputs for various tasks.
Contain tasks that provide methods, such as getProperties(), Javadoc comments or an external describing file that ships with the task class to recognize the attributes of the tasks explicitly.
Allow you to add listeners to or remove listeners from the build process from within the buildfile and change the behavior of the added listeners using BuildListener.
Provide a built-in mechanism to define new data types. For example, you can select the files present in the fileset data type based on modification time or file permissions.
Support task multithreading, which means the ability to execute several tasks simultaneously.
Document all the tasks in XML files using Document Type Definition (DTD).
Combine duplicate tasks into one super task. For example, all the tasks that perform operations on Zip files, such as jar, unjar, zip, and unzip are combined into one task called archive.
| Table of Contents |