Skip to Content
Ant: The Definitive Guide
book

Ant: The Definitive Guide

by Eric M. Burke, Jesse Tilly
May 2002
Intermediate to advanced
288 pages
10h 50m
English
O'Reilly Media, Inc.
Content preview from Ant: The Definitive Guide

An Example Through Analysis: The jar Task

Now that the theoretical stuff is behind us, let’s look at what happens when rubber meets the road. To develop your own Ant task, write a Java class that implements your design. The complexity or simplicity of your task is up to you. It’s only important that your Java class conform to the conventions set forth in Ant’s object model.

As an example of how to write tasks, we present an analysis of an existing task: jar. The jar task touches upon all of the topics we need to cover. The Jar task class is part of a deep hierarchy, demonstrating re-use through inheritance. It derives from Zip, which, in turn, derives from MatchingTask. The Jar task object does not have its own execute( ) method implementation, relying, instead, on that method’s implementation in the Zip classes. This shows how loose some of the requirements are in regards to your own implementations. The jar task also uses a multitude of attributes and nested elements, giving us good examples of how to handle all of these features. Using an existing task as an example reinforces the concept that there is no difference between user-written tasks and those included with the Ant distribution.

Analyzing jar gives us some insight into how to design a task. It has unique and easy-to-understand design goals. We have a task design with object re-use that is open for future extension. War and Ear derive from Jar, obtaining the same benefits. However, we will not cover every feature and ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Ant in Action

Ant in Action

Steve Loughran, Erik Hatcher
Ant Developer’s Handbook

Ant Developer’s Handbook

Alan Williamson, Kirk Pepperdine, Joey Gibson, Andrew Wu

Publisher Resources

ISBN: 0596001843Catalog PageErrata