You are previewing Ant Developer’s Handbook.
O'Reilly logo
Ant Developer’s Handbook

Book Description

Ant has emerged as the preferred building tool for Java developers, automating tedious compilation, test, and code management. Many Java developers are aware of Ant but there is little documentation to assist in getting started with the Ant tool. Even experienced developers who already use some of the features of the Ant tool, struggle with the more advanced aspects. This book will educate those devlopers in these more advanced topics, and help them get more out of the tool. The Ant Developer's Handbook begins with a rapid introduction to obtaining, installing, and configuring Ant and covers all major feature sets and use practices.

Ant is a cross-platform build and configuration management tool. It is written in Java, and uses XML as its file format, thereby allowing entire development teams to share Ant build files, regardless of the operating system each developer is using. Ant can perform nearly any common configuration management function, including:

  • compiling application source code.

  • running test suites and building archive files.

  • moving/copying files to server machines.

  • interacting with source control systems.

Table of Contents

  1. Copyright
  2. About the Authors
  3. Acknowledgments
  4. We Want to Hear from You!
  5. Introduction
  6. Introduction to Ant
    1. In the Beginning
    2. The First Ant Project
    3. Ant Terminology
    4. Should I Use Ant?
    5. Summary
  7. Preliminaries
    1. How to Get Ant
    2. How to Install Ant
    3. A Tour of Ant with a Small Exercise
    4. Summary
  8. Global Concepts
    1. Developing in a Standard Directory Tree
    2. Creating Standard Ant Targets and What They Should Do
    3. Exploring Ant Data Types
    4. Listeners and Loggers
    5. Predefined Properties
    6. The Ant Command Line
    7. Summary
  9. Built-In Tasks
    1. Common Attributes of All Tasks
    2. <ant>
    3. <antcall>
    4. <antstructure>
    5. <apply>/<execon>
    6. <available>
    7. <basename>
    8. <buildnumber>
    9. <Bunzip2>
    10. <BZip2>
    11. <checksum>
    12. <chmod>
    13. <concat>
    14. <condition>
    15. <Copy>
    16. <copydir>
    17. <copyfile>
    18. <cvs>
    19. <cvschangelog>
    20. <cvspass>
    21. <cvstagdiff>
    22. <delete>
    23. <deltree>
    24. <dependset>
    25. <dirname>
    26. <ear>
    27. <echo>
    28. <exec>
    29. <fail>
    30. <filter>
    31. <fixcrlf>
    32. <genkey>
    33. <get>
    34. <gunzip>
    35. <gzip>
    36. <input>
    37. <jar>
    38. <java>
    39. <javac>
    40. <javadoc> and <javadoc2>
    41. <loadFile>
    42. <loadproperties>
    43. <mail>
    44. <manifest>
    45. <mkdir>
    46. <move>
    47. <parallel> and <sequential>
    48. <patch>
    49. <pathconvert>
    50. <property>
    51. <record>
    52. <rename>
    53. <replace>
    54. <rmic>
    55. <sequential>
    56. <signjar>
    57. <sleep>
    58. <sql>
    59. <style>
    60. <tar>
    61. <taskdef>
    62. <touch>
    63. <tstamp>
    64. <typedef>
    65. <Unjar>, <Untar>, <Unwar>, <Unzip>
    66. <uptodate>
    67. <waitfor>
    68. <war>
    69. <xmlproperty>
    70. <xslt>
    71. <zip>
    72. Summary
  10. Optional Tasks
    1. Additional Resources for Ant
    2. ANTLR
    3. <cab>
    4. <depend>
    5. <echoproperties>
    6. <ftp>
    7. <icontract>
    8. <propertyfile>
    9. <javacc>
    10. <jjtree>
    11. <javah>
    12. <jspc>
    13. <junit>
    14. <junitreport>
    15. <replaceregexp>
    16. <setproxy>
    17. <sound>
    18. <splash>
    19. <telnet>
    20. <xmlvalidate>
    21. Summary
  11. Extending Ant with Custom Tasks, Data Types, and Listeners
    1. Matching Class to Source
    2. Life Cycle of a Task
    3. An Informal Contract for a Custom Task
    4. Requirements for ClassToSource
    5. An Implementation for ClassToSource
    6. Adding Nested Elements to a Custom Task
    7. Custom DataTypes
    8. A Custom DataType for ClassToSource
    9. Using a Predefined Data Type
    10. Custom Listeners
    11. Summary
  12. Troubleshooting Ant Build Scripts
    1. Common Debugging Techniques
    2. Syntax Errors
    3. Semantic Errors
    4. Programmatic Errors
    5. Ant Message Levels
    6. Using a Java Debugger
    7. Support Resources and Rules of Engagement
    8. Common Problems and Solutions
    9. Summary
  13. Performing End to End Builds on a Nightly Basis
    1. What Is End to End Building?
    2. Targets for EtE Builds
    3. Summary
  14. Ant in the Real World
    1. The Large Sample Application
    2. A Standard Build Environment
    3. Decomposing the Build
    4. Ant Properties
    5. Standard Build Targets
    6. Building the Channel Component
    7. Building the Common Layer
    8. Building the Chat Server
    9. Building the Chat Client
    10. A One-Shot Build of the ChatRoom Application
    11. Some Benefits of Chaining Builds
    12. Summary
  15. The Future Direction of Ant
    1. Ant 2
    2. What Can I Do to Help?
    3. Summary
  16. Tool Support for Ant
    1. Ant Farm for jEdit
    2. AntRunner for JBuilder
    3. Sun ONE Studio (AKA Forte for Java)
    4. Eclipse
    5. CruiseControl
    6. Control Center
    7. IntelliJ IDEA 2.5
    8. Summary
  17. Index