Ant in Action : Covers Ant 1. 7

  • ISBN13:


  • ISBN10:


  • Edition: 2nd
  • Format: Paperback
  • Copyright: 2007-07-01
  • Publisher: Oreilly & Associates Inc
  • Purchase Benefits
  • Free Shipping On Orders Over $35!
    Your order must be $35 or more to qualify for free economy shipping. Bulk sales, PO's, Marketplace items, eBooks and apparel do not qualify for this offer.
  • Get Rewarded for Ordering Your Textbooks! Enroll Now
List Price: $49.99 Save up to $7.50
  • Buy New
    Add to Cart Free Shipping


Supplemental Materials

What is included with this book?

  • The New copy of this book will include any supplemental materials advertised. Please check the title of the book to determine if it should include any access cards, study guides, lab manuals, CDs, etc.


This second edition of a Manning bestseller has been revised and re-titled to fit the 'In Action' Series by Steve Loughran, an Ant project committer. Ant in Action introduces Ant and how to use it for test-driven Java application development. Ant itself is moving to v1.7, a major revision, at the end of 2006 so the timing for the book is right. A single application of increasing complexity, followed throughout the book, shows how an application evolves and how to handle the problems of building and testing. Reviewers have praised the book's coverage of large-projects, Ant's advanced features, and the details and depth of the discussion-all unavailable elsewhere.

Author Biography

Steve Loughran has been an active user and developer of Ant since the year 2000, a committer on the project since 2001, and a member of the Apache Software Foundation since 2004. He regularly lectures on the problems of big-system builds, distributed testing, and deployment. He is a research scientist at Hewlett-Packard Laboratories in Bristol, UK.

Table of Contents

Preface to the second editionp. xix
Foreword to the first editionp. xxi
Preface to the first editionp. xxiii
Acknowledgmentsp. xxv
About this bookp. xxvii
About the authorsp. xxxi
About the cover illustrationp. xxxii
Introduction to the Second Editionp. 1
Learning Antp. 3
Introducing Antp. 5
What is Ant?p. 5
The core concepts of Antp. 6
Ant in action: an example projectp. 8
What makes Ant so special?p. 11
When to use Antp. 12
When not to use Antp. 13
Alternatives to Antp. 13
IDEsp. 13
Makep. 14
Mavenp. 16
The ongoing-evolution of Antp. 16
Summaryp. 17
A first Ant buildp. 19
Defining our first projectp. 19
Step zero: creating the project directoryp. 20
Step one: verifying the tools are in placep. 20
Step two: writing your first Ant build filep. 21
Examining the build filep. 21
Step three: running your first buildp. 23
If the build failsp. 23
Looking at the build in more detailp. 25
Step four: imposing structurep. 27
Laying out the source directoriesp. 28
Laying out the build directoriesp. 29
Laying out the distribution directoriesp. 29
Creating the build filep. 31
Target dependenciesp. 32
Running the new build filep. 33
Incremental buildsp. 34
Running multiple targets on the command linep. 35
Step five: running our programp. 36
Why execute from inside Ant?p. 36
Adding an "execute" targetp. 37
Running the new targetp. 38
Ant command-line optionsp. 39
Specifying which build file to runp. 40
Controlling the amount of information providedp. 41
Coping with failurep. 42
Getting information about a projectp. 42
Examining the final build filep. 43
Running the build under an IDEp. 44
Summaryp. 45
Understanding Ant datatypes and propertiesp. 47
Preliminariesp. 48
What is an Ant datatype?p. 48
Property overviewp. 48
Introducing datatypes and properties with [left angle bracket]javac[right angle bracket]p. 49
Pathsp. 52
How to use a pathp. 53
Filesetsp. 53
Patternsetsp. 54
Selectorsp. 58
Additional Ant datatypesp. 59
Propertiesp. 61
Setting properties with the [left angle bracket]property[right angle bracket] taskp. 62
Checking for the availability of files: [left angle bracket]available[right angle bracket]p. 66
Testing conditions with [left angle bracket]condition[right angle bracket]p. 67
Creating a build timestamp with [left angle bracket]tstamp[right angle bracket]p. 69
Setting properties from the command linep. 70
Controlling Ant with propertiesp. 70
Conditional target executionp. 71
Conditional build failurep. 72
Conditional patternset inclusion/exclusionp. 72
Referencesp. 73
Viewing datatypesp. 73
Managing library dependenciesp. 75
Resources: Ant's secret data modelp. 76
Best practicesp. 76
Summaryp. 77
Testing with JUnitp. 79
What is testing, and why do it?p. 80
Introducing our applicationp. 81
The application: a diaryp. 81
How to test a programp. 83
Introducing JUnitp. 84
Writing a test casep. 86
Running a test casep. 86
Asserting desired resultsp. 87
Adding JUnit to Antp. 90
Writing the codep. 92
The JUnit task: [left angle bracket]junit[right angle bracket]p. 93
Fitting JUnit into the build processp. 94
Halting the build when tests failp. 96
Viewing test resultsp. 96
Running multiple tests with [left angle bracket]batchtest[right angle bracket]p. 98
Generating HTML test reportsp. 99
Halting the builds after generating reportsp. 101
Advanced [left angle bracket]junit[right angle bracket] techniquesp. 102
Best practicesp. 106
The future of JUnitp. 107
Summaryp. 108
Packaging projectsp. 110
Working with filesp. 111
Deleting filesp. 112
Copying filesp. 113
Moving and renaming filesp. 114
Introducing mappersp. 114
Modifying files as you gop. 119
Preparing to packagep. 120
Adding data files to the classpathp. 121
Generating documentationp. 122
Patching line endings for target platformsp. 124
Creating JAR filesp. 126
Testing the JAR filep. 128
Creating JAR manifestsp. 129
Adding extra metadata on the JARp. 131
JAR file best practicesp. 132
Signing JAR filesp. 132
Testing with JAR filesp. 135
Creating Zip filesp. 136
Creating a binary Zip distributionp. 137
Creating a source distributionp. 138
Zip file best practicesp. 139
Packaging for Unixp. 139
Tar filesp. 139
Generating RPM packagesp. 143
Working with resourcesp. 143
A formal definition of a resourcep. 143
What resources are there?p. 144
Resource collectionsp. 145
Summaryp. 147
Executing programsp. 149
Running programs under Ant-an introductionp. 149
Introducing the [left angle bracket]java[right angle bracket] taskp. 151
Setting the classpathp. 152
Argumentsp. 153
Defining system propertiesp. 155
Running the program in a new JVMp. 156
JVM tuningp. 157
Handling errorsp. 158
Executing JAR filesp. 160
Running native programsp. 161
Running our diary as a native programp. 162
Executing shell commandsp. 162
Running under different Operating Systemsp. 163
Probing for a programp. 166
Advanced [left angle bracket]java[right angle bracket] and [left angle bracket]exec[right angle bracket]p. 167
Setting environment variablesp. 167
Handling timeoutsp. 168
Running a program in the backgroundp. 169
Input and outputp. 170
Piped I/O with an I/O redirectorp. 171
FilterChains and FilterReadersp. 172
Bulk operations with [left angle bracket]apply[right angle bracket]p. 174
How it all worksp. 176
[left angle bracket]java[right angle bracket]p. 176
[left angle bracket]exec[right angle bracket] and [left angle bracket]apply[right angle bracket]p. 177
Best practicesp. 177
Summaryp. 178
Distributing our applicationp. 179
Preparing for distributionp. 180
Securing our distributionp. 181
Server requirementsp. 183
FTP-based distribution of a packaged applicationp. 183
Uploading to Unixp. 184
Uploading to a Windows FTP serverp. 185
Uploading to SourceForgep. 186
FTP dependency logicp. 187
Email-based distribution of a packaged applicationp. 188
Sending HTML messagesp. 191
Secure distribution with SSH and SCPp. 192
Uploading files with SCPp. 193
Downloading files with [left angle bracket]scp[right angle bracket]p. 195
Remote execution with [left angle bracket]sshexec[right angle bracket]p. 197
Troubleshooting the SSH tasksp. 197
HTTP downloadp. 198
How to probe for a server or web pagep. 199
Fetching remote files with [left angle bracket]get[right angle bracket]p. 200
Performing the downloadp. 201
Distribution over multiple channelsp. 203
Calling targets with [left angle bracket]antcall[right angle bracket]p. 203
Distributing with [left angle bracket]antcall[right angle bracket]p. 206
Summaryp. 208
Putting it all togetherp. 209
How to write good build filesp. 209
Building the diary libraryp. 210
Starting the projectp. 210
The public entry pointsp. 211
Setting up the buildp. 212
Compiling and testingp. 216
Packaging and creating a distributionp. 218
Distributionp. 222
Adopting Antp. 225
Building an existing project under Antp. 228
Summaryp. 230
Applying Antp. 231
Beyond Ant's core tasksp. 233
The many different categories of Ant tasksp. 234
Installing optional tasksp. 236
Troubleshootingp. 238
Optional tasks in actionp. 239
Manipulating property filesp. 239
Improving [left angle bracket]javac[right angle bracket] with dependency checkingp. 241
Software configuration management under Antp. 243
Using third-party tasksp. 245
Defining tasks with [left angle bracket]taskdef[right angle bracket]p. 246
Declaring tasks defined in property filesp. 247
Defining tasks into a unique namespacep. 248
Defining tasks from an Antlibp. 249
The Ant-contrib tasksp. 250
The Ant-contrib tasks in actionp. 253
Code auditing with Checkstylep. 259
Summaryp. 263
Working with big projectsp. 264
Master builds: managing large projectsp. 265
Introducing the [left angle bracket]ant[right angle bracket] taskp. 266
Designing a scalable, flexible master build filep. 268
Controlling child project buildsp. 270
Setting properties in child projectsp. 270
Passing down properties and references in [left angle bracket]ant[right angle bracket]p. 272
Advanced delegationp. 275
Getting data backp. 276
Inheriting build files through [left angle bracket]import[right angle bracket]p. 277
XML entity inclusionp. 277
Importing build files with [left angle bracket]import[right angle bracket]p. 278
How Ant overrides targetsp. 279
Calling overridden targetsp. 280
The special properties of [left angle bracket]import[right angle bracket]p. 281
Applying [left angle bracket]import[right angle bracket]p. 283
Extending an existing build filep. 283
Creating a base build file for many projectsp. 284
Mixin build filesp. 286
Best practices with [left angle bracket]import[right angle bracket]p. 287
Ant's macro facilitiesp. 288
Redefining tasks with [left angle bracket]presetdef[right angle bracket]p. 288
The hazards of [left angle bracket]presetdef[right angle bracket]p. 290
Writing macros with [left angle bracket]macrodef[right angle bracket]p. 291
Passing data to a macrop. 292
Local variablesp. 294
Effective macro usep. 295
Summaryp. 296
Managing dependenciesp. 297
Introducing Ivyp. 299
The core concepts of Ivyp. 299
Installing Ivyp. 301
Configuring Ivyp. 302
Resolving, reporting, and retrievingp. 304
Creating a dependency reportp. 305
Retrieving artifactsp. 306
Setting up the classpaths with Ivyp. 307
Working across projects with Ivyp. 308
Sharing artifacts between projectsp. 308
Using published artifacts in other projectsp. 310
Using Ivy to choreograph buildsp. 313
Other aspects of Ivyp. 315
Managing file versions through Ivy variablesp. 315
Finding artifacts on the central repositoryp. 316
Excluding unwanted dependenciesp. 317
Private repositoriesp. 317
Moving to Ivyp. 318
Summaryp. 318
Developing for the Webp. 320
Developing a web applicationp. 321
Writing a feed servletp. 323
Libraries in web applicationsp. 324
Writing web pagesp. 325
Creating a web.xml filep. 327
Building the WAR filep. 328
Deploymentp. 329
Deployment by copyp. 330
Post-deployment activitiesp. 331
Probing for server availabilityp. 331
Pausing the build with [left angle bracket]sleep[right angle bracket]p. 333
Testing web applications with HttpUnitp. 333
Writing HttpUnit testsp. 334
Compiling the HttpUnit testsp. 337
Running the HttpUnit testsp. 338
Summaryp. 339
Working with XMLp. 340
Background: XML-processing librariesp. 341
Writing XMLp. 341
Validating XMLp. 343
Validating documents using DTD filesp. 345
Validating documents with XML Schemap. 347
Validating RelaxNG documentsp. 349
Reading XML datap. 352
Transforming XML with XSLTp. 353
Defining the structure of the constants filep. 354
Creating the constants filep. 355
Creating XSL style sheetsp. 355
Initializing the build filep. 358
Summaryp. 362
Enterprise Javap. 363
Evolving the diary applicationp. 364
Making an Enterprise applicationp. 365
Creating the beansp. 366
Compiling Java EE-annotated classesp. 368
Adding a session beanp. 369
Extending the web applicationp. 371
Building the Enterprise applicationp. 373
Deploying to the application serverp. 378
Server-side testing with Apache Cactusp. 378
Writing a Cactus testp. 379
Building Cactus testsp. 380
The Cactus Ant tasksp. 381
Adding Cactus to an EAR filep. 382
Running Cactus testsp. 383
Diagnosing EJB deployment problemsp. 384
Summaryp. 385
Continuous integrationp. 387
Introducing continuous integrationp. 388
What do you need for continuous integration?p. 390
Luntbuildp. 391
Installing Luntbuildp. 393
Running Luntbuildp. 393
Configuring Luntbuildp. 394
Luntbuild in actionp. 400
Review of Luntbuildp. 401
Moving to continuous integrationp. 402
Summaryp. 404
Deploymentp. 406
How to survive deploymentp. 407
Deploying with Antp. 410
Database setup in Antp. 411
Creating and configuring a database from Antp. 412
Issuing database administration commandsp. 413
Deploying with SmartFrogp. 415
SmartFrog: a new way of thinking about deploymentp. 415
The concepts in more detailp. 417
The SmartFrog componentsp. 425
Using SmartFrog with Antp. 426
Deploying with SmartFrogp. 428
Deploying with the [left angle bracket]deploy[right angle bracket] taskp. 433
Summary of SmartFrogp. 435
Embracing deploymentp. 436
Summaryp. 438
Extending Antp. 441
Writing Ant tasksp. 443
What exactly is an Ant task?p. 444
The life of a taskp. 445
Introducing Ant's Java APIp. 446
Ant's utility classesp. 451
A useful task: [left angle bracket]filesize[right angle bracket]p. 453
Writing the taskp. 453
How Ant configures tasksp. 455
Configuring the [left angle bracket]filesize[right angle bracket] taskp. 457
Testing tasks with AntUnitp. 458
Using AntUnitp. 458
Testing the [left angle bracket]filesize[right angle bracket] taskp. 460
Running the testsp. 461
More task attributesp. 463
Enumerationsp. 463
User-defined typesp. 465
Supporting nested elementsp. 465
Working with resourcesp. 467
Using a resource-enabled taskp. 470
Delegating to other tasksp. 471
Setting up classpaths in a taskp. 472
Other task techniquesp. 476
Making an Antlib libraryp. 478
Summaryp. 481
Extending Ant furtherp. 483
Scripting within Antp. 484
Writing new tasks with [left angle bracket]scriptdef[right angle bracket]p. 486
Scripting summaryp. 489
Conditionsp. 490
Writing a conditional taskp. 492
Writing a custom resourcep. 493
Using a custom resourcep. 496
How Ant datatypes handle referencesp. 496
Selectorsp. 497
Scripted selectorsp. 499
Developing a custom mapperp. 499
Implementing a custom filterp. 501
Handling Ant's input and outputp. 503
Writing a custom listenerp. 505
Writing a custom loggerp. 509
Using loggers and listenersp. 511
Handling user input with an InputHandlerp. 512
Embedding Antp. 512
Summaryp. 514
Installationp. 516
Before you beginp. 516
The steps to install Antp. 517
Setting up Ant on Windowsp. 517
Setting up Ant on Unixp. 518
Installation configurationp. 520
Troubleshooting installationp. 520
XML Primerp. 525
XML namespacesp. 529
IDE Integrationp. 531
How IDEs use Antp. 531
Eclipse http://www.eclipse.org/p. 533
Sun NetBeans http://www.netbeans.org/p. 539
IntelliJ IDEA http://intellij.com/p. 543
Building with Ant and an IDEp. 546
Indexp. 549
Table of Contents provided by Ingram. All Rights Reserved.

Rewards Program

Write a Review