March 5, 2021
Hot Topics:

XP and Ant

  • By Sams Publishing
  • Send Email »
  • More Articles »


Ant is an open-source build and deployment tool that enables users to rapidly configure platform-independent build processes. Because Ant is written in Java, it's supported on any platform that has a Java Virtual Machine implementation available, which is nearly everything. It uses XML, which is a technology that is familiar to many developers. Because XML is fairly intuitive and self-documenting, Ant processes tend to be fairly readable and easy to maintain. Ant has an extremely rich feature set and can be extended when a unique or proprietary function is required. It has a gentle learning curve, and developers can easily put together a useful XML file with very little Ant experience.

But Ant also is a powerful tool that an advanced developer won't quickly outgrow. Because Ant is open-source, it's possible to obtain extensions to it from third-party sources. Ant also offers the possibility of extension by writing custom Java classes or using scripting languages and Ant's BSF scripting engine. If all else fails, a user can always shell out to the native operating system to perform a specific function. Because of these features, developers will never find themselves painted into a corner.

Ant offers numerous advantages over other possible choices for build environments and tools, such as make or various IDEs. Because many IDE products support Ant, users can leverage the power of the IDE while still using Ant.

Admittedly, in some situations, other solutions might be preferable. For one thing, Ant is Java-centric. Although it's not imperative to know Java to use Ant, it is useful. A situation in which another solution might be preferable arises when a development team already has expertise in another technology and has no experience with Ant, Java, or XML. Another case might be a project with a legacy build system that has been thoroughly debugged and works well. In such a case, it might not be justifiable to scrap the current build system in favor of a new one. However, when starting a new project, especially a Java-based project, or when the current build system is difficult to maintain, we believe that Ant should be the tool of choice.

The Scope of This Book

Throughout this book, we'll follow a group in a fictitious company called Networks Byte Design, which is implementing a project using XP. The primary focus will be on the details of how they implement their processes with Ant. But following the project should also provide other insight into the implementation of XP.

This is a book about how to implement XP processes with Ant. This book does not discuss topics such as how to effectively refactor code. It is intended to be a practical guide about implementing the repeatable build, testing, and deployment processes that XP requires, by using Ant. It does cover topics that have to do with automating processes, including

  • Compiling code

  • Packaging

  • Automating unit tests

  • Automating acceptance tests

  • Generating deployment descriptors in the build process

  • Creating a continuous build process

  • Creating distributed build and deployment processes

  • Maintaining project standards (such as coding standards)

  • Generating metrics about the code

  • Generating documentation

  • Use of third-party tools

This book will also show how to extend Ant by writing custom components in Java and by using the BSF scripting capability in Ant. Included are a number of custom components written in Java that you can download from the Sams Web site and apply to your project.

About the Authors

Jeremy Poteet has more than 15 years experience in software development. He has led numerous Java development and XP projects and has incorporated Ant at several customer sites. He has been involved in every aspect of the software development process, with team sizes ranging from 1 to over 100. Jeremy is currently the Chief Technology Officer at Technology Partners, Inc., a consulting company specializing in application development and security, located in Chesterfield, Missouri. He was the winner in the 2002 eWeek OpenLabs OpenHack IV competition, and can be reached at jpoteet@tech-partners.com.

Glenn Niemeyer is a consultant with Technology Partners Inc., a Mid-west based Consulting Firm. He has a Masters Degree in Electrical Engineering from the University of Missouri, and 15 years of experience in software development. Glenn joined Technology Partners in 1996, and has been a technical team leader and project leader on a number of software development projects. He is also active in the area of Application Security. Glenn can be reached at gniemeyer@tech-partners.com

Source of this material

This material is from Chapter 1, XP and Ant, from the book Extreme Programming with Ant: Building and Deploying Java Applications with JSP, EJB, XSLT, XDoclet, and JUnit (ISBN: 0-672-32562-4) written by Glenn Niemeyer and Jeremy Poteet, published by Sams Publishing.

To access the full Table of Contents for the book

Other Chapters from Sams Publishing:

Web Services and Flows (WSFL)
Overview of JXTA
Introduction to EJBs
Processing Speech with Java
P2P Dynamic Networks

Page 6 of 6

This article was originally published on May 20, 2003

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date