O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Ant: The Definitive Guide

Book Description

Ant is the premiere build management tool for use in Java environments. Unlike traditional build management tools such as GNU Make, Ant is itself written in Java, is platform independent, and interfaces well with the utilities in Sun's Java software development kit (SDK). In addition to being platform independent, Ant is also independent of the integrated development environment (IDE) being used. IDE independence is important for open source projects (or other projects) in which the various developers might use different IDEs. Using Ant, Java developers can:

  • Define build chunks, the results that they must produce, and the dependencies between them

  • Automatically retrieve source code from source control systems such as PVCS

  • Build applications by having Ant compile the necessary source files in the proper order

  • Ant build files are written using XML-a well-established standard-so programmers using Ant are not required to learn yet another scripting language. They will likely already know XML, and will be able to leverage that knowledge. Ant is an open source project, and part of the Jakarta project. Jakarta is Sun's open source reference implementation for the JSP and Servlets specifications, and is part of the Apache group's work

    Table of Contents

    1. Ant: The Definitive Guide
      1. Foreword
      2. Preface
        1. Structure of This Book
        2. Audience
        3. What You Should Know
        4. Which Platform and Version
        5. Conventions Used in This book
          1. Terminology
          2. Filename and Path Conventions
        6. Comments and Questions
        7. Acknowledgments
          1. From Jesse
          2. From Eric
      3. 1. Ant Jumpstart
        1. Files and Directories
        2. The Ant Buildfile
          1. Buildfile Description
        3. Running Ant
          1. Examples
          2. Getting Help
        4. Ant Command-Line Reference
        5. Buildfile Outline
        6. Learning More
      4. 2. Installation and Configuration
        1. The Distribution
        2. Installation
          1. Binary Installation
          2. Optional Tasks Installation
          3. Source Installation
            1. Preparing optional tasks
            2. Building the Ant binaries
            3. Avoiding JavaDoc generation
            4. Building Ant 1.2
          4. Windows Installation Issues
            1. Setting environment variables
            2. Avoiding CLASSPATH problems
            3. Customizing Ant 1.3 and 1.4.1
          5. Unix Installation Issues
        3. Configuration
          1. XML Issues
          2. Proxy Configuration
      5. 3. The Buildfile
        1. Why XML?
        2. Ant Building Blocks
          1. The Project
          2. Targets
          3. Tasks
          4. Data Elements
            1. Properties
            2. DataTypes
        3. An Example Project and Buildfile
          1. Understanding the Project Structure
          2. Designing and Writing the Example Buildfile
            1. The project descriptor
            2. Global values
            3. Directory creation
            4. Compiling
            5. Cleanup
            6. Distribution
        4. The Buildfile Execution Process
          1. Error Handling
            1. Project-level errors
            2. Target-level errors
            3. Error-handling examples
          2. Project-Level Data Elements and Tasks
          3. Targets
            1. The bot target
            2. Dependency checking
            3. Packaging the class files
            4. The module target
          4. The Other Targets
            1. The javadoc target
            2. Cleanup
            3. Deployment and installation
        5. AINASL: Ant Is Not a Scripting Language
          1. Look Ma, No Data Structures!
          2. Where’s the DTD?
          3. Flow Control
        6. Buildfile Authoring Issues
      6. 4. Ant DataTypes
        1. DataTypes Defined
        2. XML Attribute Conventions
        3. Argument DataType
          1. Example
          2. Additional Examples
        4. Environment DataType
          1. Example
          2. Using Environment Variables in Buildfiles
        5. FileList DataType
          1. Example
        6. FileSet DataType
          1. Examples
        7. PatternSet DataType
          1. Examples
            1. Copying files
            2. Conditionally including files
        8. FilterSet DataType
          1. Example
        9. Path DataType
        10. Mapper DataType
          1. Example
          2. The Identity Mapper
          3. The Flatten Mapper
          4. The Glob Mapper
          5. The Merge Mapper
          6. The Regexp Mapper
      7. 5. User-Written Tasks
        1. The Need for Custom Tasks
        2. Ant’s Task Model
          1. The Parts of a Task
            1. The common superclasses
            2. Attributes
            3. Nested elements
          2. Communication Between Ant and Tasks
            1. The Project class
            2. Build exceptions
            3. The logging system
        3. The Task Life Cycle
          1. The Parse Phase
          2. The Runtime Phase
        4. An Example Through Analysis: The jar Task
          1. Design the jar Task
          2. Leverage Prior Work
          3. Implement the Attribute Setter Methods
          4. Implement Nested Element Handling
          5. Implement the execute( ) Method
            1. Validation
            2. Doing the actual work
            3. Error handling
          6. Compile the Task
          7. Deploy and Declare the Task
        5. Miscellaneous Task Topics
          1. Magic Properties
          2. The Problem with System.exit( )
      8. 6. User-Written Listeners
        1. The BuildEvent Class
        2. The BuildListener Interface
        3. An Example: XmlLogger
        4. The Parallel Problem
      9. 7. Core Tasks
        1. Task Summary
        2. Common Types and Attributes
          1. XML Attribute Conventions
          2. Common Attributes
        3. Project and Target
          1. project
            1. Attributes
            2. Content
          2. target
            1. Attributes
            2. Content
        4. Core Task Reference
        5. ant
          1. ant
        6. antcall
          1. antcall
        7. antstructure
          1. antstructure
        8. apply
          1. apply
        9. available
          1. available
        10. chmod
          1. chmod
        11. condition
          1. condition
        12. copy
          1. copy
        13. copydir
          1. copydir
        14. copyfile
          1. copyfile
        15. cvs
          1. cvs
        16. cvspass
          1. cvspass
        17. delete
          1. delete
        18. deltree
          1. deltree
        19. dependset
          1. dependset
        20. ear
          1. ear
        21. echo
          1. echo
        22. exec
          1. exec
        23. execon
          1. execon
        24. fail
          1. fail
        25. filter
          1. filter
        26. fixcrlf
          1. fixcrlf
        27. genkey
          1. genkey
        28. get
          1. get
        29. gunzip
          1. gunzip
        30. gzip
          1. gzip
        31. jar
          1. jar
        32. java
          1. java
        33. javac
          1. javac
        34. javadoc
          1. javadoc
        35. mail
          1. mail
        36. mkdir
          1. mkdir
        37. move
          1. move
        38. parallel
          1. parallel
        39. patch
          1. patch
        40. pathconvert
          1. pathconvert
        41. property
          1. property
        42. record
          1. record
        43. rename
          1. rename
        44. replace
          1. replace
        45. rmic
          1. rmic
        46. sequential
          1. sequential
        47. signjar
          1. signjar
        48. sleep
          1. sleep
        49. sql
          1. sql
        50. style
          1. style
        51. tar
          1. tar
        52. taskdef
          1. taskdef
        53. touch
          1. touch
        54. tstamp
          1. tstamp
        55. typedef
          1. typedef
        56. unjar
          1. unjar
        57. untar
          1. untar
        58. unwar
          1. unwar
        59. unzip (also unjar and unwar)
          1. unzip (also unjar and unwar)
        60. uptodate
          1. uptodate
        61. war
          1. war
        62. zip
          1. zip
      10. 8. Optional Tasks
        1. Task Summary
        2. Optional Task Reference
        3. antlr
          1. antlr
        4. blgenclient
          1. blgenclient
        5. cab
          1. cab
        6. cccheckin
          1. cccheckin
        7. cccheckout
          1. cccheckout
        8. ccmcheckin
          1. ccmcheckin
        9. ccmcheckintask
          1. ccmcheckintask
        10. ccmcheckout
          1. ccmcheckout
        11. ccmcreatetask
          1. ccmcreatetask
        12. ccmreconfigure
          1. ccmreconfigure
        13. ccuncheckout
          1. ccuncheckout
        14. ccupdate
          1. ccupdate
        15. csc
          1. csc
        16. ddcreator
          1. ddcreator
        17. depend
          1. depend
        18. ejbc
          1. ejbc
        19. ejbjar
          1. ejbjar
        20. ftp
          1. ftp
        21. icontract
          1. icontract
        22. ilasm
          1. ilasm
        23. iplanet-ejbc
          1. iplanet-ejbc
        24. javacc
          1. javacc
        25. javah
          1. javah
        26. jdepend
          1. jdepend
        27. jjtree
          1. jjtree
        28. jlink
          1. jlink
        29. jpcoverage
          1. jpcoverage
        30. jpcovmerge
          1. jpcovmerge
        31. jpcovreport
          1. jpcovreport
        32. junit
          1. junit
        33. junitreport
          1. junitreport
        34. maudit
          1. maudit
        35. mimemail
          1. mimemail
        36. mmetrics
          1. mmetrics
        37. mparse
          1. mparse
        38. native2ascii
          1. native2ascii
        39. netrexxc
          1. netrexxc
        40. p4change
          1. p4change
        41. p4counter
          1. p4counter
        42. p4edit
          1. p4edit
        43. p4have
          1. p4have
        44. p4label
          1. p4label
        45. p4reopen
          1. p4reopen
        46. p4revert
          1. p4revert
        47. p4submit
          1. p4submit
        48. p4sync
          1. p4sync
        49. propertyfile
          1. propertyfile
        50. pvcs
          1. pvcs
        51. renameext
          1. renameext
        52. rpm
          1. rpm
        53. script
          1. script
        54. sound
          1. sound
        55. starteam
          1. starteam
        56. stylebook
          1. stylebook
        57. telnet
          1. telnet
        58. test
          1. test
        59. vsscheckin
          1. vsscheckin
        60. vsscheckout
          1. vsscheckout
        61. vssget
          1. vssget
        62. vsshistory
          1. vsshistory
        63. vsslabel
          1. vsslabel
        64. wljspc
          1. wljspc
        65. wlrun
          1. wlrun
        66. wlstop
          1. wlstop
        67. xmlvalidate
          1. xmlvalidate
      11. A. The Future of Ant
        1. Ant2
        2. Ant1 RIP 2002?
      12. B. Ant Solutions
        1. Testing Library Availability
        2. Cleaning Up Does More Than Keep Things Neat
        3. Using Ant to Consolidate Libraries
        4. Documenting the Buildfile’s Targets
        5. Setting Properties Outside of the Buildfile
        6. Using pathconvert
        7. Usage Statements
        8. Forking Processes
        9. Using Cascading Projects and Buildfiles
      13. Index
      14. Colophon