Michael Rash1-59327-141-7, 1-59327-141-7, 978-1-59327-141-1
1 Apache Ant User Manual Authors …………………………………………………………….. 11
2 Feedback and Troubleshooting……………………………………………………………….. 12
3 Introduction …………………………………………………………………………………….. 13
3.1 Why? ………………………………………………………………………………………. 13
4 Installing Ant ……………………………………………………………………………………. 14
4.1 Getting Ant ……………………………………………………………………………….. 14
4.1.1 Binary Edition………………………………………………………………………….. 14
4.1.2 Source Edition…………………………………………………………………………. 14
4.2 System Requirements…………………………………………………………………… 14
4.3 Installing Ant …………………………………………………………………………….. 14
4.3.1 Setup …………………………………………………………………………………… 15
4.3.2 Optional Tasks ………………………………………………………………………… 15
4.3.3 Windows ……………………………………………………………………………….. 15
4.3.4 Unix (bash)…………………………………………………………………………….. 16
4.3.5 Unix (csh) ……………………………………………………………………………… 16
4.3.6 Advanced ………………………………………………………………………………. 16
4.4 Building Ant ………………………………………………………………………………. 16
4.5 Library Dependencies …………………………………………………………………… 17
4.6 Platform Issues…………………………………………………………………………… 18
4.6.1 Unix …………………………………………………………………………………….. 18
4.6.2 Microsoft Windows ……………………………………………………………………. 19
4.6.3 Apple MacOS X ………………………………………………………………………… 19
4.6.4 Novell Netware ………………………………………………………………………… 19
4.6.5 Other platforms ……………………………………………………………………….. 20
5 Running Ant …………………………………………………………………………………….. 21
5.1 Command Line …………………………………………………………………………… 21
5.2 Cygwin Users …………………………………………………………………………….. 23
5.3 Running Ant via Java ……………………………………………………………………. 23
6 Using Ant ………………………………………………………………………………………… 24
6.1 Writing a Simple Buildfile ……………………………………………………………….. 24
6.1.1 Projects ………………………………………………………………………………… 24
6.1.2 Targets…………………………………………………………………………………. 24
6.1.3 Tasks……………………………………………………………………………………. 25
6.1.4 Properties………………………………………………………………………………. 26
6.1.5 Built-in Properties …………………………………………………………………….. 26
6.1.6 Example Buildfile ……………………………………………………………………… 27
6.1.7 Token Filters …………………………………………………………………………… 28
6.1.8 Path-like Structures…………………………………………………………………… 28
6.1.9 Command-line Arguments…………………………………………………………… 30
6.1.10 Examples ……………………………………………………………………………. 30
6.1.11 References ………………………………………………………………………….. 30
7 Concepts…………………………………………………………………………………………. 32
7.1 build.sysclasspath ……………………………………………………………………….. 32
7.2 Common Attributes of all Tasks ……………………………………………………….. 32
7.3 Core Types ……………………………………………………………………………….. 32
7.3.1 Description …………………………………………………………………………….. 32
7.3.2 Directory-based Tasks ……………………………………………………………….. 32
7.3.3 DirSet …………………………………………………………………………………… 36
7.3.4 FileList ………………………………………………………………………………….. 37
7.3.5 FileSet ………………………………………………………………………………….. 38
7.3.6 Mapping File Names ………………………………………………………………….. 39
7.3.7 FilterChains and FilterReaders ………………………………………………………. 42
7.3.8 FilterReader……………………………………………………………………………. 44
7.3.9 ExpandProperties ……………………………………………………………………… 45
7.3.10 HeadFilter …………………………………………………………………………… 46
7.3.11 LineContains ………………………………………………………………………… 46
7.3.12 LineContainsRegExp ……………………………………………………………….. 47
7.3.13 PrefixLines…………………………………………………………………………… 47
7.3.14 ReplaceTokens ……………………………………………………………………… 47
7.3.15 StripJavaComments ……………………………………………………………….. 48
7.3.16 StripLineBreaks …………………………………………………………………….. 48
7.3.17 StripLineComments………………………………………………………………… 49
7.3.18 TabsToSpaces………………………………………………………………………. 49
7.3.19 TailFilter……………………………………………………………………………… 50
7.3.20 FilterSet ……………………………………………………………………………… 51
7.3.21 PatternSet…………………………………………………………………………… 52
7.3.22 Selectors…………………………………………………………………………….. 54
7.3.22.1 How to use a Selector………………………………………………………………………… 54
7.3.22.2 Core Selectors ………………………………………………………………………………….. 54
7.3.22.3 Contains Selector ……………………………………………………………………………… 54
7.3.22.4 Date Selector……………………………………………………………………………………. 55
7.3.22.5 Depend Selector ……………………………………………………………………………….. 55
7.3.22.6 Depth Selector………………………………………………………………………………….. 56
7.3.22.7 Filename Selector……………………………………………………………………………… 56
7.3.22.8 Present Selector………………………………………………………………………………… 57
7.3.22.9 Size Selector…………………………………………………………………………………….. 57
7.3.22.10 Selector Containers …………………………………………………………………………… 58
7.3.22.11 And Selector…………………………………………………………………………………….. 58
7.3.22.12 Majority Selector………………………………………………………………………………. 59
7.3.22.13 None Selector …………………………………………………………………………………… 59
7.3.22.14 Not Selector……………………………………………………………………………………… 59
7.3.22.15 Or Selector ………………………………………………………………………………………. 60
7.3.22.16 Selector Reference ……………………………………………………………………………. 60
7.3.22.17 Custom Selectors………………………………………………………………………………. 60
7.3.23 XMLCatalog …………………………………………………………………………. 61
7.3.23.1 Entity/DTD/URI Resolution Algorithm ………………………………………………. 62
7.3.23.2 XMLCatalog attributes ……………………………………………………………………… 63
7.3.23.3 XMLCatalog nested elements …………………………………………………………….. 63
7.4 Optional Types …………………………………………………………………………… 64
7.4.1 ClassFileSet ……………………………………………………………………………. 64
7.4.2 Extension ………………………………………………………………………………. 65
7.4.3 ExtensionSet …………………………………………………………………………… 66
8 Ant Tasks………………………………………………………………………………………… 68
8.1 Overview of Ant Tasks ………………………………………………………………….. 68
8.1.1 Archive Tasks ………………………………………………………………………….. 68
8.1.2 Audit/Coverage Tasks ………………………………………………………………… 68
8.1.3 Compile Tasks …………………………………………………………………………. 68
8.1.4 Deployment Tasks ……………………………………………………………………. 69
8.1.5 Documentation Tasks ………………………………………………………………… 69
8.1.6 EJB Tasks ………………………………………………………………………………. 69
8.1.7 Execution Tasks ……………………………………………………………………….. 69
8.1.8 File Tasks ………………………………………………………………………………. 69
8.1.9 Java2 Extensions Tasks ………………………………………………………………. 70
8.1.10 Logging Tasks ………………………………………………………………………. 70
8.1.11 Mail Tasks …………………………………………………………………………… 70
8.1.12 Miscellaneous Tasks ……………………………………………………………….. 70
8.1.13 .NET Tasks ………………………………………………………………………….. 71
8.1.14 Pre-process Tasks………………………………………………………………….. 71
8.1.15 Property Tasks ……………………………………………………………………… 71
8.1.16 Remote Tasks ………………………………………………………………………. 72
8.1.17 SCM Tasks…………………………………………………………………………… 72
8.1.18 Testing Tasks ……………………………………………………………………….. 72
8.1.19 Visual Age for Java Tasks …………………………………………………………. 72
9 Core Tasks ………………………………………………………………………………………. 74
9.1 Ant …………………………………………………………………………………………. 74
9.2 AntCall …………………………………………………………………………………….. 76
9.3 AntStructure ……………………………………………………………………………… 77
9.4 Apply/ExecOn…………………………………………………………………………….. 78
9.5 Available ………………………………………………………………………………….. 80
9.6 Basename …………………………………………………………………………………. 82
9.7 BuildNumber……………………………………………………………………………… 82
9.8 BUnzip2 / GUnzip………………………………………………………………………… 83
9.9 BZip2 / GZip ……………………………………………………………………………… 84
9.10 Checksum…………………………………………………………………………………. 84
9.11 Chmod …………………………………………………………………………………….. 86
9.12 Concat …………………………………………………………………………………….. 87
9.13 Condition ………………………………………………………………………………….. 88
9.13.1 Conditions …………………………………………………………………………… 89
9.14 Copy……………………………………………………………………………………….. 90
9.15 Copydir – Deprecated …………………………………………………………………… 93
9.16 Copyfile – Deprecated…………………………………………………………………… 94
9.17 Cvs…………………………………………………………………………………………. 94
9.18 CvsChangeLog ……………………………………………………………………………. 96
9.19 cvspass……………………………………………………………………………………. 98
9.20 CvsTagDiff ………………………………………………………………………………… 98
9.21 Delete……………………………………………………………………………………..100
9.22 Deltree – Deprecated……………………………………………………………………102
9.23 DependSet ………………………………………………………………………………..102
9.24 Dirname …………………………………………………………………………………..103
9.25 Ear …………………………………………………………………………………………104
9.26 Echo ……………………………………………………………………………………….105
9.27 Exec ……………………………………………………………………………………….106
9.28 Fail …………………………………………………………………………………………108
9.29 Filter……………………………………………………………………………………….109
9.30 FixCRLF ……………………………………………………………………………………109
9.31 GenKey ……………………………………………………………………………………112
9.32 Get…………………………………………………………………………………………113
9.33 GUnzip…………………………………………………………………………………….114
9.34 GZip / BZip2 ……………………………………………………………………………..114
9.35 Input ………………………………………………………………………………………114
9.36 Jar …………………………………………………………………………………………115
9.37 Java ……………………………………………………………………………………….118
9.38 Javac ………………………………………………………………………………………120
9.39 Javadoc/Javadoc2……………………………………………………………………….125
9.40 LoadFile …………………………………………………………………………………..131
9.41 LoadProperties……………………………………………………………………………132
9.42 Mail ………………………………………………………………………………………..133
9.43 Manifest …………………………………………………………………………………..134
9.44 Mkdir ………………………………………………………………………………………136
9.45 Move ………………………………………………………………………………………136
9.46 Parallel…………………………………………………………………………………….138
9.47 Patch………………………………………………………………………………………139
9.48 Pathconvert ………………………………………………………………………………139
9.49 Property…………………………………………………………………………………..141
9.50 Record …………………………………………………………………………………….143
9.51 Rename – Deprecated…………………………………………………………………..145
9.52 Replace……………………………………………………………………………………145
9.52.1 replacefilter …………………………………………………………………………146
9.53 Rmic ……………………………………………………………………………………….147
9.54 Sequential …………..
Reviews
There are no reviews yet.