Ant: The Definitive Guide and over one million other books are available for Amazon Kindle . Learn more


or
Sign in to turn on 1-Click ordering.
or
Amazon Prime free trial required. Sign up when you check out. Learn more
More Buying Choices
Have one to sell? Sell yours here
or
Get a £2.35 Amazon.co.uk Gift Card
Ant: The Definitive Guide
 
 
Start reading Ant: The Definitive Guide on your Kindle in under a minute.

Don't have a Kindle? Get your Kindle here, or download a FREE Kindle Reading App.

Ant: The Definitive Guide [Paperback]

Steve Holzner
3.0 out of 5 stars  See all reviews (1 customer review)
RRP: £34.50
Price: £29.33 & this item Delivered FREE in the UK with Super Saver Delivery. See details and conditions
You Save: £5.17 (15%)
o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o
In stock.
Dispatched from and sold by Amazon.co.uk. Gift-wrap available.
Only 2 left in stock--order soon (more on the way).
Want guaranteed delivery by Tuesday, May 29? Choose Express delivery at checkout. See Details
‹  Return to Product Overview

Product Description

Product Description

Soon after its launch, Ant succeeded in taking the Java world by storm, becoming the most widely used tool for building applications in Java environments. Like most popular technologies, Ant quickly went through a series of early revision cycles. With each new version, more functionality was added, and more complexity was introduced. Ant evolved from a simple-to-learn build tool into a full-fledged testing and deployment environment.

Ant: The Definitive Guide has been reworked, revised and expanded upon to reflect this evolution. It documents the new ways that Ant is being applied, as well as the array of optional tasks that Ant supports. In fact, this new second edition covers everything about this extraordinary build management tool from downloading and installing, to using Ant to test code. Here are just of a few of the features you'll find detailed in this comprehensive, must-have guide:

  • Developing conditional builds, and handling error conditions
  • Automatically retrieving source code from version control systems
  • Using Ant with XML files
  • Using Ant with JavaServer Pages to build Web applications
  • Using Ant with Enterprise JavaBeans to build enterprise applications
Far exceeding its predecessor in terms of information and detail, Ant: The Definitive Guide, 2nd Edition is a must-have for Java developers unfamiliar with the latest advancements in Ant technology. With this book at your side, you'll soon be up to speed on the premiere tool for cross-platform development.

Author Steve Holzner is an award-winning author who s been writing about Java topics since the language first appeared; his books have sold more than 1.5 million copies worldwide.

From the Publisher

As the most widely used tool for cross-platform development, Ant has undergone a number of important changes in its functionality and use since its launch. Ant: The Definitive Guide, 2nd Edition has been reworked to reflect these changes for Java developers everywhere. Topics covered include everything from downloading and installing, to using Ant to build Web applications, to using Ant to test code.

About the Author

Steve Holzner is an award-winning author who has been writing about Java topics since Java first appeared. He's a former PC Magazine contributing editor, and his many books have been translated into 18 languages around the world. His books sold more than 1.5 million copies, and many of his bestsellers have been on Java. Steve graduated from MIT and got his PhD at Cornell; he's been a very popular member of the faculty at both MIT and Cornell, teaching thousands of students over the years and earning an average student evaluation over 4.9 out of 5.0. He also runs his own software company and teaches week-long classes to corporate programmers on Java around the country.

Excerpted from Ant The Definitive Guide by Steve Holzner. Copyright © 2005. Reprinted by permission. All rights reserved.

Chapter 6 Getting Source Code from CVS Repositories

Up to this point, you’ve been working solo with Ant, but - as with any major build Tool - Ant can be used in team environments. There’s a lot of support built in for the
Concurrent Version System (CVS) in Ant, and this chapter is all about making code sharing in teams with CVS happen.

Source Control and Ant

When you work in teams, you have to coordinate your efforts. That means discussing and planning, but even with the best of intentions, you can still end up with unintentional conflicts. You may have made some brilliant changes to the code, only to find them wiped out by mistake when another programmer uploads his own version of the same file.

Source control helps prevent these problems by controlling access to code and by maintaining a history of the changes made so things aren’t destroyed unintentionally. Storing a history of your code is powerful; you can compare a new (buggy) file against an older one, and you can revert to a previous version in case things have gone bad.

Ant has several source control tasks, shown in Table 6-1.

Though Ant lets you work with various source control systems, most of its support revolves around CVS, which is used throughout this chapter. CVS is an open source project that started as a set of Unix shell scripts in 1986 and came into its own with dedicated software in 1989. Support for CVS is available on many operating systems: Unix, Linux, Windows, Mac, and others. For the full CVS story, look at cvshome.org.

To work with CVS using Ant, you need access to a CVS server. Most Linux and Unix installations come with a built-in CVS server. To test if you have a working CVS installation, type cvs --help at the prompt; you should see a list of help items. If you can’t find a CVS server, you can download what you need from cvshome.org. Many CVS servers are available for Windows, such as CVSNT, available for free from cvsnt.org. To install CVSNT, download the executable file and run it.

The idea behind CVS, as with any repository software, is to manage and record changes to source code. What corresponds to a project for Ant is a module in CVS. Modules are represented by directories in CVS; the files you share are stored in the CVS repository. When you retrieve a file from the repository, you check the file out. After you’ve modified the file, you commit the file, checking it back in and sending those changes to the repository. If you want to refresh your own copy of a file, you update it from the repository.

Because each file must be independently tracked, CVS gives the individual files a version number automatically. Each time a file is committed, its version number isincremented. When you commit files to the repository, they’ll get a new version number as well.

Using the cvs task, you communicate with the CVS server using CVS commands, which appear in Table 6-2.

Read more about these commands in the CVS guide at cvshome.org/docs/manual/cvs-1.11.7/cvs_16.html.

The first step in working with CVS is to log into the CVS server, typically done with the cvspass task.

Logging In

You use the cvspass task to log into a CVS server to get access to the code stored in the CVS repository. This task adds entries to a .cvspass file, which has the same affect as a CVS login command. When a .cvspass file has been created, subsequent logins will get the needed data from this file, and you won’t have to supply a password again.

The values you assign to the attribute named cvsroot use the same format of strings that appear in a CVS .cvspass file, which specifies the protocol type, username, server, and repository location. For example, using the pserver protocol with a user named Steven, a server named STEVE, and a repository location of /home/steven/repository, cvspass would look like:

.
.
.

The CVS-related tasks can read the CVS root value from the cvsroot attribute, if they support that attribute, or from the CVSROOT environment variable.

In Windows, when your username includes a space or spaces, you might run into problems with the cvsroot attribute. In that case, assign a value to the CVSROOT environment variable instead (e.g., C:\ant\ch06>set CVSROOT=:pserver:Steven Holzner@STEVE:/home/steven/repository) and then use cvspass or other CVS-related tasks in your build file normally.

Working with the Server

The cvs task lets you interact with the CVS server after you’ve logged in. The attributes of this task appear in Table 6-4; to use this task, the cvs command must work on the command line (i.e., the cvs binary must be in your path).

This task is designed to pass commands on to CVS verbatim. For example, here’s how you’d pass a CVS diff command to the CVS server:

You can nest commandline elements and use the value attribute of argument elements to pass arguments to the CVS server; you can pass the diff command this way:

or this way, using the argument element’s line attribute:

/

‹  Return to Product Overview

Amazon.co.uk Privacy Statement Amazon.co.uk Delivery Information Amazon.co.uk Returns & Exchanges