You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.html 82 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <title>Ant</title>
  5. </head>
  6. <body>
  7. <h1>Ant User Manual</h1>
  8. <p>by</p>
  9. <!-- Names are in alphabetical order, on last name -->
  10. <ul>
  11. <li>James Duncan Davison (<a href="mailto:(duncan@x180.com">duncan@x180.com</a>)</li>
  12. <li>Arnout J. Kuiper (<a href="mailto:(ajkuiper@wxs.nl">ajkuiper@wxs.nl</a>)</li>
  13. <li>Stefano Mazzocchi (<a href="mailto:(stefano@apache.org">stefano@apache.org</a>)</li>
  14. </ul>
  15. <p>Version 1.0.4 - 2000/02/10</p>
  16. <hr>
  17. <h2>Table of Contents</h2>
  18. <ul>
  19. <li><a href="#introduction">Introduction</a></li>
  20. <li><a href="#getting">Getting Ant</a></li>
  21. <li><a href="#buildingant">Building Ant</a></li>
  22. <li><a href="#installing">Installing Ant</a></li>
  23. <li><a href="#running">Running Ant</a></li>
  24. <li><a href="#buildfile">Writing a simple buildfile</a>
  25. <li><a href="#directorybasedtasks">Directory based tasks</a></li>
  26. <li><a href="#tasks">Built in Tasks</a>
  27. <li><a href="#writingowntask">Writing your own task</a></li>
  28. <li><a href="#license">License</a></li>
  29. <li><a href="#feedback">Feedback</a></li>
  30. </ul>
  31. <hr>
  32. <h2><a name="introduction">Introduction</a></h2>
  33. <p>Ant is a Java based build tool. In theory it is kind of like make without
  34. makes wrinkles.</p>
  35. <h3>Why?</h3>
  36. <p>Why another build tool when there is already make, gnumake, nmake, jam, and
  37. others? Because all of those tools have limitations that its original author
  38. couldn't live with when developing software across multiple platforms. Make like
  39. tools are inherently shell based. They evaluate a set of dependencies and then
  40. execute commands not unlike what you would issue on a shell. This means that you
  41. can easily extend these tools by using or writing any program for the OS that
  42. you are working on. However, this also means that you limit yourself to the OS,
  43. or at least the OS type such as Unix, that you are working on.</p>
  44. <p>Makefiles are inherently evil as well. Anybody who has worked on them for any
  45. time has run into the dreaded tab problem. &quot;Is my command not executing
  46. because I have a space in front of my tab!!!&quot; said the original author of
  47. Ant way too many times. Tools like Jam took care of this to a great degree, but
  48. still use yet another format to use and remember.</p>
  49. <p>Ant is different. Instead a model where it is extended with shell based
  50. commands, it is extended using Java classes. Instead of writing shell commands,
  51. the configuration files are XML based calling out a target tree where various
  52. tasks get executed. Each task is run by an object which implements a particular
  53. Task interface.</p>
  54. <p>Granted, this removes some of the expressive power that is inherent by being
  55. able to construct a shell command such as `find . -name foo -exec rm {}` but it
  56. gives you the ability to be cross platform. To work anywhere and everywhere. And
  57. hey, if you really need to execute a shell command, Ant has an exec rule that
  58. allows different commands to be executed based on the OS that it is executing
  59. on.</p>
  60. <hr>
  61. <h2><a name="getting">Getting Ant</a></h2>
  62. <h3>Binary edition</h3>
  63. <p>The latest stable version of Ant can be downloaded from <a
  64. href="http://jakarta.apache.org/builds/tomcat/release/v3.0/ant.zip">http://jakarta.apache.org/builds/tomcat/release/v3.0/ant.zip</a>.
  65. If you like living on the edge, you can download the latest version from <a
  66. href="http://jakarta.apache.org/builds/tomcat/nightly/ant.zip">http://jakarta.apache.org/builds/tomcat/nightly/ant.zip</a>.</p>
  67. <h3>Source edition</h3>
  68. <p>If you prefer the source edition, you can download Ant from <a
  69. href="http://jakarta.apache.org/builds/tomcat/release/v3.0/src/jakarta-tools.src.zip">http://jakarta.apache.org/builds/tomcat/release/v3.0/src/jakarta-tools.src.zip</a>
  70. (latest stable) or from <a
  71. href="http://jakarta.apache.org/from-cvs/jakarta-tools/">http://jakarta.apache.org/from-cvs/jakarta-ant/</a>
  72. (current). See the section <a href="#buildingant">Building Ant</a> on how to
  73. build Ant from the source code.</p>
  74. <hr>
  75. <h2><a name="buildingant">Building Ant</a></h2>
  76. <p>Go to the directory <code>jakarta-ant</code>.</p>
  77. <p>Make sure the JDK is in you path.</p>
  78. <p>Run <code>bootstrap.bat</code> (Windows) or <code>bootstrap.sh</code> (UNIX)
  79. to build a bootstrap version of Ant.</p>
  80. <p>When finished, use</p>
  81. <blockquote>
  82. <p><code>build.bat -Ddist.dir=&lt;directory to install Ant&gt; dist</code></p>
  83. </blockquote>
  84. <p>for Windows, and</p>
  85. <blockquote>
  86. <p><code>build.sh -Ddist.dir=&lt;directory to install Ant&gt; dist</code></p>
  87. </blockquote>
  88. <p>for UNIX, to create a binary distribution of Ant. This distribution can be
  89. found in the directory you specified.</p>
  90. <hr>
  91. <h2><a name="installing">Installing Ant</a></h2>
  92. <p>The binary distribution of Ant consists of three directories: <code>bin</code>,
  93. <code>docs</code> and <code>lib</code>. Only the <code>bin</code> and <code>lib</code>
  94. directory are crucial for running Ant. To run Ant, the following must be done:</p>
  95. <ul>
  96. <li>Add the <code>bin</code> directory to your path.</li>
  97. <li>Set the ANT_HOME environment variable. This should be set to the directory
  98. which contains the <code>bin</code> and <code>lib</code> directory.</li>
  99. <li>Set the JAVA_HOME environment variable. This should be set to the
  100. directory where the JDK is installed.</li>
  101. </ul>
  102. <h3>Windows</h3>
  103. <p>Assume Ant is installed in <code>c:\ant\</code>. The following sets up the
  104. environment:</p>
  105. <pre>set ANT_HOME=c:\ant
  106. set JAVA_HOME=c:\jdk1.2.2
  107. set PATH=%PATH%;%ANT_HOME%\bin</pre>
  108. <h3>Unix (bash)</h3>
  109. <p>Assume Ant is installed in <code>/usr/local/ant</code>. The following sets up
  110. the environment:</p>
  111. <pre>export ANT_HOME=/usr/local/ant
  112. export JAVA_HOME=/usr/local/jdk-1.2.2
  113. export PATH=${PATH}:${ANT_HOME}/bin</pre>
  114. <h3>Advanced</h3>
  115. <p>There are lots of variants that can be used to run Ant. What you need is at
  116. least the following:</p>
  117. <p>The classpath for Ant must contain <code>ant.jar</code> and <code>xml.jar</code>.</p>
  118. <p>When you need JDK functionality (like a <a href="#javac">javac</a> task, or a
  119. <a href="#rmic">rmic</a> task), then for JDK 1.1, the <code>classes.zip</code>
  120. file of the JDK must be added to the classpath; for JDK 1.2, <code>tools.jar</code>
  121. must be added.</p>
  122. <p>When you are executing platform specific applications (like the <a
  123. href="#exec">exec</a> task, or the <a href="#cvs">cvs</a> task), the property <code>ant.home</code>
  124. must be set to the directory containing a bin directory, which contains the <code>antRun</code> shell script necessary to run execs on Unix.</p>
  125. <hr>
  126. <h2><a name="running">Running Ant</a></h2>
  127. <p>Running Ant is simple, when you installed it as described in the previous
  128. section. Just type <code>ant</code>.</p>
  129. <p>When nothing is specified, Ant looks for a <code>build.xml</code> file in the
  130. current directory. When found, it uses that file as a buildfile. To make Ant use
  131. another buildfile, use the commandline option <i>-buildfile &lt;file&gt;</i>,
  132. where <i>&lt;file&gt;</i> is the buildfile you want to use.</p>
  133. <p>You can also set properties which override properties specified in the
  134. buildfile. This can be done with the <i>-D&lt;property&gt;=&lt;value&gt;</i>
  135. option, where <i>&lt;property&gt;</i> is the name of the property and <i>&lt;value&gt;</i>
  136. the value.</p>
  137. <p>To more options are <i>-quiet</i> which instructs Ant to print less
  138. information on the console when running. The option <i>-verbose</i> on the other
  139. hand makes Ant print more information on the console.</p>
  140. <p>It is also possible to specify the target that should be executed. Default
  141. the target that is mentioned in the <i>default</i> attribute of the project is
  142. used. This can be overridden by adding the target name to the end of the
  143. commandline.</p>
  144. <p>Commandline option summary:</p>
  145. <pre>ant [options] [target]
  146. Options:
  147. -help print this message
  148. -quiet be extra quiet
  149. -verbose be extra verbose
  150. -logfile &lt;file&gt; use given file for log
  151. -buildfile &lt;file&gt; use given buildfile
  152. -D&lt;property&gt;=&lt;value&gt; use value for given property</pre>
  153. <h3>Examples</h3>
  154. <blockquote>
  155. <pre>ant</pre>
  156. </blockquote>
  157. <p>runs Ant using the <code>build.xml</code> file in the current directory, on
  158. the default target.</p>
  159. <blockquote>
  160. <pre>ant -buildfile test.xml</pre>
  161. </blockquote>
  162. <p>runs Ant using the <code>test.xml</code> file in the current directory, on
  163. the default target.</p>
  164. <blockquote>
  165. <pre>ant -buildfile test.xml dist</pre>
  166. </blockquote>
  167. <p>runs Ant using the <code>test.xml</code> file in the current directory, on a
  168. target called <code>dist</code>.</p>
  169. <blockquote>
  170. <pre>ant -buildfile test.xml -Dbuild=build/classes dist</pre>
  171. </blockquote>
  172. <p>runs Ant using the <code>test.xml</code> file in the current directory, on a
  173. target called <code>dist</code>. It also sets the <i>build</i> property to the
  174. value <i>build/classes</i>.</p>
  175. <h3>Running Ant by hand</h3>
  176. <p>When you have installed Ant in the do-it-yourself way, Ant can be started
  177. with:</p>
  178. <blockquote>
  179. <pre>set CLASSPATH=c:\ant\lib\ant.jar;c:\ant\lib\xml.jar;c:\jdk1.2.2\lib\tools.jar
  180. java -Dant.home=c:\ant org.apache.tools.ant.Main [options] [target]</pre>
  181. </blockquote>
  182. <p>These instructions actually do exactly the same as the <code>ant</code>
  183. command. The options and target are the same as when running Ant with the <code>ant</code>
  184. command.</p>
  185. <hr>
  186. <h2><a name="buildfile">Writing a simple buildfile</a></h2>
  187. <p>The buildfile is an written in XML. Each buildfile contains one project.</p>
  188. <h3>Projects</h3>
  189. <p>A project has three attributes:</p>
  190. <table border="1" cellpadding="2" cellspacing="0">
  191. <tr>
  192. <td valign="top"><b>Attribute</b></td>
  193. <td valign="top"><b>Description</b></td>
  194. <td align="center" valign="top"><b>Required</b></td>
  195. </tr>
  196. <tr>
  197. <td valign="top">name</td>
  198. <td valign="top">the name of the project.</td>
  199. <td align="center" valign="top">Yes</td>
  200. </tr>
  201. <tr>
  202. <td valign="top">default</td>
  203. <td valign="top">the default target to use when no target is supplied.</td>
  204. <td align="center" valign="top">Yes</td>
  205. </tr>
  206. <tr>
  207. <td valign="top">basedir</td>
  208. <td valign="top">the base directory from which all path calculations are
  209. done. This attribute might be overridden by setting the &quot;basedir&quot;
  210. property on forehand. When this is done, it might be ommitted in the
  211. project tag.</td>
  212. <td align="center" valign="top">Yes</td>
  213. </tr>
  214. </table>
  215. <p>Each project defines one or more targets. A target is a set of tasks you want
  216. to be executed. When starting Ant, you can select which target you want to have
  217. executed. When no target is given, the project's default is used.</p>
  218. <h3>Targets</h3>
  219. <p>A target can depend on other targets. You might have a target for compiling,
  220. for instance, and a target for creating a distributable. You can only build a
  221. distributable when you have compiled first, so the distribute target depends on
  222. the compile target. Ant resolves all these dependencies.</p>
  223. <p>Ant tries to execute the targets in the <i>depends</i> attribute in the order
  224. they appear (from left to right). Keep in mind that it is possible that a target
  225. can get executed earlier when an earlier target depends on it:</p>
  226. <blockquote>
  227. <pre>&lt;target name=&quot;A&quot;/&gt;
  228. &lt;target name=&quot;B&quot; depends=&quot;A&quot;/&gt;
  229. &lt;target name=&quot;C&quot; depends=&quot;B&quot;/&gt;
  230. &lt;target name=&quot;D&quot; depends=&quot;C,B,A&quot;/&gt;</pre>
  231. </blockquote>
  232. <p>Suppose we want to execute target D. From its <i>depends</i> attribute, you
  233. might think that first target C, then B and then A is executed. Wrong! C depends
  234. on B, and B depends on A, so first A is executed, then B, then C, and finally D.</p>
  235. <p>In situations without such dependencies, you can rely on the order of the
  236. targets in the <i>depends</i> attributes.</p>
  237. <p>A target gets executed only once. Even when more targets depend on it (see
  238. the previous example).</p>
  239. <p>A target has also the ability to perform its execution if a property has been
  240. set. This allows, for example, better control on the building process depending
  241. on the state of the system (java version, OS, command line properties, etc...).
  242. To make target <i>sense</i> this property you should add the <i>if</i> attribute
  243. with the name of the property that the target should react to, for example</p>
  244. <blockquote>
  245. <pre>&lt;target name=&quot;build-module-A&quot; if=&quot;module-A-present&quot;/&gt;</pre>
  246. </blockquote>
  247. <p>If no <i>if</i> attribute is present, the target will always be executed.</p>
  248. <p>A target has the following attributes:</p>
  249. <table border="1" cellpadding="2" cellspacing="0">
  250. <tr>
  251. <td valign="top"><b>Attribute</b></td>
  252. <td valign="top"><b>Description</b></td>
  253. <td align="center" valign="top"><b>Required</b></td>
  254. </tr>
  255. <tr>
  256. <td valign="top">name</td>
  257. <td valign="top">the name of the project.</td>
  258. <td align="center" valign="top">Yes</td>
  259. </tr>
  260. <tr>
  261. <td valign="top">depends</td>
  262. <td valign="top">a comma separated list of names of targets on which this
  263. target depends.</td>
  264. <td align="center" valign="top">No</td>
  265. </tr>
  266. <tr>
  267. <td valign="top">if</td>
  268. <td valign="top">the name of the property that must be set in order for this
  269. target to execute.</td>
  270. <td align="center" valign="top">No</td>
  271. </tr>
  272. </table>
  273. <h3>Tasks</h3>
  274. <p>A task is a piece of code that can be executed.</p>
  275. <p>A task can have multiple attributes (or arguments if you prefer). The value
  276. of an attribute might contain references to a property. These references will be
  277. resolved before the task is executed.</p>
  278. <p>Tasks have a common structure:</p>
  279. <blockquote>
  280. <pre>&lt;name attribute1=&quot;value1&quot; attribute2=&quot;value2&quot; ... /&gt;</pre>
  281. </blockquote>
  282. <p>where name is the name of the task, attribute-x the attribute name, and
  283. value-x the value of this attribute.</p>
  284. <p>There is a set of <a href="#tasks">built in tasks</a>, but it is also very
  285. easy to <a href="#writingowntask">write your own</a>.</p>
  286. <h3>Properties</h3>
  287. <p>A project can have a set of properties. These might be set in the buildfile
  288. by the <a href="#property">property task</a>, or might be set outside Ant. A
  289. property has a name and a value. Properties might be used in in the value of
  290. task attributes. This is done by placing the property name between
  291. &quot;${&quot; and &quot;}&quot; in the attribute value.</p>
  292. <p>If there is a property called &quot;builddir&quot; with the value
  293. &quot;build&quot;, then this could be used in an attribute like this: &quot;${builddir}/classes&quot;.
  294. This is resolved as &quot;build/classes&quot;.</p>
  295. <h3>Examples</h3>
  296. <blockquote>
  297. <pre>&lt;project name=&quot;foo&quot; default=&quot;dist&quot; basedir=&quot;.&quot;&gt;
  298. &lt;target name=&quot;init&quot;&gt;
  299. &lt;tstamp/&gt;
  300. &lt;property name=&quot;build&quot; value=&quot;build&quot; /&gt;
  301. &lt;property name=&quot;dist&quot; value=&quot;dist&quot; /&gt;
  302. &lt;/target&gt;
  303. &lt;target name=&quot;prepare&quot; depends=&quot;init&quot;&gt;
  304. &lt;mkdir dir=&quot;${build}&quot; /&gt;
  305. &lt;/target&gt;
  306. &lt;target name=&quot;compile&quot; depends=&quot;prepare&quot;&gt;
  307. &lt;javac srcdir=&quot;${src}&quot; destdir=&quot;${build}&quot; /&gt;
  308. &lt;/target&gt;
  309. &lt;target name=&quot;dist&quot; depends=&quot;compile&quot;&gt;
  310. &lt;mkdir dir=&quot;${dist}/lib&quot; /&gt;
  311. &lt;jar jarfile=&quot;${dist}/lib/foo${DSTAMP}.jar&quot;
  312. basedir=&quot;${build}&quot; items=&quot;com&quot;/&gt;
  313. &lt;/target&gt;
  314. &lt;target name=&quot;clean&quot; depends=&quot;init&quot;&gt;
  315. &lt;deltree dir=&quot;${build}&quot; /&gt;
  316. &lt;deltree dir=&quot;${dist}&quot; /&gt;
  317. &lt;/target&gt;
  318. &lt;/project&gt;
  319. </pre>
  320. </blockquote>
  321. <hr>
  322. <h2><a name="directorybasedtasks">Directory based tasks</a></h2>
  323. <p>Some tasks use directory trees for the task they perform. For instance, the <a
  324. href="#javac">Javac task</a> which works upon a directory tree with .java files.
  325. Sometimes it can be very useful to work on a subset of that directory tree. This
  326. section describes how you can select a subset of such a directory tree.</p>
  327. <p>Ant gives you two ways to create a subset, which both can be used at the same
  328. time:</p>
  329. <ul>
  330. <li>Only include files/directories that match at least one pattern of a set of
  331. patterns</li>
  332. <li>Exclude files/directories that match at least one pattern a set of
  333. patterns</li>
  334. </ul>
  335. <p>When both inclusion and exclusion are used, only files/directories that match
  336. the include patterns, and don't match the exclude patterns are used.</p>
  337. <h3>Patterns</h3>
  338. <p>As described earlier, patterns are used for the inclusion and exclusion.
  339. These patterns look very much like the patterns used in DOS and UNIX:</p>
  340. <p>'*' matches zero or more characters, '?' matches one character.</p>
  341. <p>Examples:</p>
  342. <p>'*.java' matches '.java', 'x.java' and 'FooBar.java', but not 'FooBar.xml'
  343. (does not end with '.java').</p>
  344. <p>'?.java' matches 'x.java', 'A.java', but not '.java' or 'xyz.java' (both
  345. don't have one character before '.java').</p>
  346. <p>Combinations of '*'s and '?'s are allowed.</p>
  347. <p>Matching is done per-directory. This means that first the first directory in
  348. the pattern is matched against the first directory in the path to match. Then
  349. the second directories are matched, and so on. E.g. when we have the pattern '/?abc/*/*.java'
  350. and the path '/xabc/foobar/test.java', then first '?abc' is matched with 'xabc',
  351. then '*' is matched with 'foobar' and finally '*.java' is matched with 'test.java'.
  352. They all match so the path matches the pattern.</p>
  353. <p>Too make things a bit more flexible, we add one extra feature, which makes it
  354. possible to match multiple directory levels. This can be used to match a
  355. complete directory tree, or a file anywhere in the directory tree. To do this, '**'
  356. must be used as the name of a directory. When '**' is used as the name of a
  357. directory in the pattern, it matches zero or more directories. For instance:
  358. '/test/**' matches all files/directories under '/test/', such as '/test/x.java',
  359. or '/test/foo/bar/xyz.html', but not '/xyz.xml'.</p>
  360. <p>There is one &quot;shorthand&quot;, if a pattern ends with '/' or '\', then '**'
  361. is appended. E.g. &quot;mypackage/test/&quot; is interpreted as were it &quot;mypackage/test/**&quot;.</p>
  362. <p>Examples:</p>
  363. <table border="1" cellpadding="2" cellspacing="0">
  364. <tr>
  365. <td valign="top">**/CVS/*</td>
  366. <td valign="top">Matches all files in CVS directories, that can be located
  367. anywhere in the directory tree.
  368. <p>Matches:</p>
  369. <p>CVS/Repository<br>
  370. org/apache/CVS/Entries<br>
  371. org/apache/jakarta/tools/ant/CVS/Entries</p>
  372. <p>But not:</p>
  373. <p>org/apache/CVS/foo/bar/Entries ('foo/bar/' part does not match)</td>
  374. </tr>
  375. <tr>
  376. <td valign="top">org/apache/jakarta/**</td>
  377. <td valign="top">Matches all files in the org/apache/jakarta directory tree.
  378. <p>Matches:</p>
  379. <p>org/apache/jakarta/tools/ant/docs/index.html<br>
  380. org/apache/jakarta/test.xml</p>
  381. <p>But not:</p>
  382. <p>org/apache/xyz.java ('jakarta'/' part is missing)</td>
  383. </tr>
  384. <tr>
  385. <td valign="top">org/apache/**/CVS/*</td>
  386. <td valign="top">Matches all files in CVS directories, that are located
  387. anywhere in the directory tree under org/apache.
  388. <p>Matches:</p>
  389. <p>org/apache/CVS/Entries<br>
  390. org/apache/jakarta/tools/ant/CVS/Entries</p>
  391. <p>But not:</p>
  392. <p>org/apache/CVS/foo/bar/Entries ('foo/bar/' part does not match)</td>
  393. </tr>
  394. <tr>
  395. <td valign="top">**/test/**</td>
  396. <td valign="top">Matches all files which have a directory 'test' in their
  397. path, including 'test' as a filename.</td>
  398. </tr>
  399. </table>
  400. <p>When these patterns are used in inclusion and exclusion, you have a powerful
  401. way to select just the files you want.</p>
  402. <h3>Examples</h3>
  403. <pre> &lt;copydir srcdir=&quot;${src}&quot;
  404. destdir=&quot;${dist}&quot;
  405. includes=&quot;**/images/*&quot;
  406. excludes=&quot;**/*.gif&quot; /&gt;</pre>
  407. <p>This copies all files in directories called &quot;images&quot;, that are
  408. located in the directory tree &quot;${src}&quot; to the destination &quot;${dist}&quot;,
  409. but excludes all &quot;*.gif&quot; files from the copy.</p>
  410. <hr>
  411. <h2><a name="tasks">Built in tasks</a></h2>
  412. <ul>
  413. <li><a href="#ant">Ant</a></li>
  414. <li><a href="#available">Available</a></li>
  415. <li><a href="#chmod">Chmod</a></li>
  416. <li><a href="#copydir">Copydir</a></li>
  417. <li><a href="#copyfile">Copyfile</a></li>
  418. <li><a href="#cvs">Cvs</a></li>
  419. <li><a href="#delete">Delete</a></li>
  420. <li><a href="#deltree">Deltree</a></li>
  421. <li><a href="#echo">Echo</a></li>
  422. <li><a href="#exec">Exec</a></li>
  423. <li><a href="#expand">Expand</a></li>
  424. <li><a href="#get">Get</a></li>
  425. <li><a href="#gzip">GZip</a></li>
  426. <li><a href="#jar">Jar</a></li>
  427. <li><a href="#java">Java</a></li>
  428. <li><a href="#javac">Javac</a></li>
  429. <li><a href="#javadoc">Javadoc/Javadoc2</a></li>
  430. <li><a href="#keysubst">KeySubst</a></li>
  431. <li><a href="#mkdir">Mkdir</a></li>
  432. <li><a href="#property">Property</a></li>
  433. <li><a href="#replace">Replace</a></li>
  434. <li><a href="#rmic">Rmic</a></li>
  435. <li><a href="#tar">Tar</a></li>
  436. <li><a href="#taskdef">Taskdef</a></li>
  437. <li><a href="#tstamp">Tstamp</a></li>
  438. <li><a href="#zip">Zip</a></li>
  439. </ul>
  440. <hr>
  441. <h2><a name="ant">Ant</a></h2>
  442. <h3><b>Description:</b></h3>
  443. <p>Runs Ant on a supplied buildfile. This can be used to build subprojects.</p>
  444. <p>When the <i>antfile</i> attribute is omitted, the file &quot;build.xml&quot;
  445. in the supplied directory (<i>dir</i> attribute) is used.</p>
  446. <p>If no target attribute is supplied, the default target of the new project is
  447. used.</p>
  448. <p>The properties of the current project will be available in the new project.
  449. These properties will override the properties that are set in the new project.
  450. (See also the <a href="#property">properties task</a>).</p>
  451. <h3>Parameters:</h3>
  452. <table border="1" cellpadding="2" cellspacing="0">
  453. <tr>
  454. <td valign="top"><b>Attribute</b></td>
  455. <td valign="top"><b>Description</b></td>
  456. <td align="center" valign="top"><b>Required</b></td>
  457. </tr>
  458. <tr>
  459. <td valign="top">antfile</td>
  460. <td valign="top">the buildfile to use.</td>
  461. <td valign="top" align="center">No</td>
  462. </tr>
  463. <tr>
  464. <td valign="top">dir</td>
  465. <td valign="top">the directory to use as a basedir for the new Ant project.</td>
  466. <td valign="top" align="center">Yes</td>
  467. </tr>
  468. <tr>
  469. <td valign="top">target</td>
  470. <td valign="top">the target of the new Ant project that should be executed.</td>
  471. <td valign="top" align="center">No</td>
  472. </tr>
  473. </table>
  474. <h3>Examples</h3>
  475. <blockquote>
  476. <p><code>&lt;ant antfile=&quot;subproject/subbuild.xml&quot; dir=&quot;subproject&quot;
  477. target=&quot;compile&quot; /&gt;</code></p>
  478. <p><code>&lt;ant dir=&quot;subproject&quot; /&gt;</code></p>
  479. </blockquote>
  480. <hr>
  481. <h2><a name="available">Available</a></h2>
  482. <h3>Description</h3>
  483. <p>Sets a property is a resource is available at runtime. This resource can be a
  484. file resource, a class in classpath or a JVM system resource.</p>
  485. <p>The value part of the properties being set is <i>true</i> if the resource is
  486. present, otherwise, the property is not set.</p>
  487. <p>Normally, this task is used to set properties that are useful to avoid target
  488. execution depending on system parameters.</p>
  489. <h3>Parameters</h3>
  490. <table border="1" cellpadding="2" cellspacing="0">
  491. <tr>
  492. <td valign="top"><b>Attribute</b></td>
  493. <td valign="top"><b>Description</b></td>
  494. <td align="center" valign="top"><b>Required</b></td>
  495. </tr>
  496. <tr>
  497. <td valign="top">name</td>
  498. <td valign="top">the name of the property to set.</td>
  499. <td valign="top" align="center">Yes</td>
  500. </tr>
  501. <tr>
  502. <td valign="top">class</td>
  503. <td valign="top">the class to look for in classpath.</td>
  504. <td valign="middle" align="center" rowspan="3">Yes</td>
  505. </tr>
  506. <tr>
  507. <td valign="top">resource</td>
  508. <td valign="top">the resource to look for in the JVM</td>
  509. </tr>
  510. <tr>
  511. <td valign="top">file</td>
  512. <td valign="top">the file to look for.</td>
  513. </tr>
  514. </table>
  515. <h3>Examples</h3>
  516. <pre> &lt;available class=&quot;org.whatever.Myclass&quot; property=&quot;Myclass.present&quot; /&gt;</pre>
  517. <p>sets the property <code><i>Myclass.present</i></code> to the value &quot;true&quot;
  518. if the <i>org.whatever.Myclass</i> is found in Ant's classpath.</p>
  519. <hr>
  520. <h2><a name="chmod">Chmod</a></h2>
  521. <h3>Description</h3>
  522. <p>Changes the permissions of a file. Right now it has efect only under Unix.
  523. The permissions are also UNIX style, like the argument for the chmod command.</p>
  524. <h3>Parameters</h3>
  525. <table border="1" cellpadding="2" cellspacing="0">
  526. <tr>
  527. <td valign="top"><b>Attribute</b></td>
  528. <td valign="top"><b>Description</b></td>
  529. <td align="center" valign="top"><b>Required</b></td>
  530. </tr>
  531. <tr>
  532. <td valign="top">src</td>
  533. <td valign="top">the file of which the permissions must be changed.</td>
  534. <td valign="top" align="center">Yes</td>
  535. </tr>
  536. <tr>
  537. <td valign="top">perm</td>
  538. <td valign="top">the new permissions.</td>
  539. <td valign="top" align="center">Yes</td>
  540. </tr>
  541. </table>
  542. <h3>Examples</h3>
  543. <blockquote>
  544. <p><code>&lt;chmod src=&quot;${dist}/start.sh&quot; perm=&quot;ugo+rx&quot;
  545. /&gt;</code></p>
  546. </blockquote>
  547. <p>makes the &quot;start.sh&quot; file readable and executable for anyone on a
  548. UNIX system.</p>
  549. <hr>
  550. <h2><a name="copydir">Copydir</a></h2>
  551. <h3>Description</h3>
  552. <p>Copies a directory tree from the source to the destination.</p>
  553. <p>It is possible to refine the set of files that are being copied. This can be
  554. done with the <i>includes</i>, <i>excludes</i> and <i>defaultexcludes</i>
  555. attributes. With the <i>includes</i> attribute you specify the files you want to
  556. have included by using patterns. The <i>exclude</i> attribute is used to specify
  557. the files you want to have excluded. This is also done with patterns. And
  558. finally with the <i>defaultexcludes</i> attribute, you can specify whether you
  559. want to use default exclusions or not. See the section on <a
  560. href="#directorybasedtasks">directory based tasks</a>, on how the
  561. inclusion/exclusion of files works, and how to write patterns. The patterns are
  562. relative to the <i>src</i> directory.</p>
  563. <p>The <i>ignore</i> attribute contains the names of the files/directories that
  564. must be excluded from the copy. The names specified in the <i>ignore</i>
  565. attribute are just names, they do not contain any path information! Note that
  566. this attribute has been replaced by the <i>excludes</i> attribute.</p>
  567. <h3>Parameters</h3>
  568. <table border="1" cellpadding="2" cellspacing="0">
  569. <tr>
  570. <td valign="top"><b>Attribute</b></td>
  571. <td valign="top"><b>Description</b></td>
  572. <td align="center" valign="top"><b>Required</b></td>
  573. </tr>
  574. <tr>
  575. <td valign="top">src</td>
  576. <td valign="top">the directory to copy.</td>
  577. <td valign="top" align="center">Yes</td>
  578. </tr>
  579. <tr>
  580. <td valign="top">dest</td>
  581. <td valign="top">the directory to copy to.</td>
  582. <td valign="top" align="center">Yes</td>
  583. </tr>
  584. <tr>
  585. <td valign="top">ignore</td>
  586. <td valign="top">comma separated list of filenames/directorynames to ignore.
  587. No files (except default excludes) are excluded when omitted. (<b>deprecated</b>,
  588. use <i>excludes</i> instead).</td>
  589. <td valign="top" align="center">No</td>
  590. </tr>
  591. <tr>
  592. <td valign="top">includes</td>
  593. <td valign="top">comma separated list of patterns of files that must be
  594. included. All files are included when omitted.</td>
  595. <td valign="top" align="center">No</td>
  596. </tr>
  597. <tr>
  598. <td valign="top">excludes</td>
  599. <td valign="top">comma separated list of patterns of files that must be
  600. excluded. No files (except default excludes) are excluded when omitted.</td>
  601. <td valign="top" align="center">No</td>
  602. </tr>
  603. <tr>
  604. <td valign="top">defaultexcludes</td>
  605. <td valign="top">indicates whether default excludes should be used or not
  606. (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when omitted.</td>
  607. <td valign="top" align="center">No</td>
  608. </tr>
  609. </table>
  610. <h3>Examples</h3>
  611. <pre> &lt;copydir src=&quot;${src}/resources&quot;
  612. dest=&quot;${dist}&quot;
  613. /&gt;</pre>
  614. <p>copies the directory <code>${src}/resources</code> to <code>${dist}</code>.</p>
  615. <pre> &lt;copydir src=&quot;${src}/resources&quot;
  616. dest=&quot;${dist}&quot;
  617. includes=&quot;**/*.java&quot;
  618. excludes=&quot;**/Test.java&quot;
  619. /&gt;</pre>
  620. <p>copies the directory <code>${src}/resources</code> to <code>${dist}</code>
  621. recursively. All java files are copied, except for files with the name <code>Test.java</code>.</p>
  622. <pre> &lt;copydir src=&quot;${src}/resources&quot;
  623. dest=&quot;${dist}&quot;
  624. includes=&quot;**/*.java&quot;
  625. excludes=&quot;mypackage/test/**&quot; /&gt;</pre>
  626. <p>copies the directory <code>${src}/resources</code> to <code>${dist}</code>
  627. recursively. All java files are copied, except for the files under the <code>mypackage/test</code>
  628. directory.</p>
  629. <hr>
  630. <h2><a name="copyfile">Copyfile</a></h2>
  631. <h3>Description</h3>
  632. <p>Copies a file from the source to the destination. The file is only copied if
  633. the source file is newer than the destination file, or when the destination file
  634. does not exist.</p>
  635. <h3>Parameters</h3>
  636. <table border="1" cellpadding="2" cellspacing="0">
  637. <tr>
  638. <td valign="top"><b>Attribute</b></td>
  639. <td valign="top"><b>Description</b></td>
  640. <td align="center" valign="top"><b>Required</b></td>
  641. </tr>
  642. <tr>
  643. <td valign="top">src</td>
  644. <td valign="top">the filename of the file to copy.</td>
  645. <td valign="top" align="center">Yes</td>
  646. </tr>
  647. <tr>
  648. <td valign="top">dest</td>
  649. <td valign="top">the filename of the file where to copy to.</td>
  650. <td valign="top" align="center">Yes</td>
  651. </tr>
  652. </table>
  653. <h3>Examples</h3>
  654. <blockquote>
  655. <p><code>&lt;copyfile src=&quot;test.java&quot; dest=&quot;subdir/test.java&quot;
  656. /&gt;</code></p>
  657. <p><code>&lt;copyfile src=&quot;${src}/index.html&quot; dest=&quot;${dist}/help/index.html&quot;
  658. /&gt;</code></p>
  659. </blockquote>
  660. <hr>
  661. <h2><a name="cvs">Cvs</a></h2>
  662. <h3>Description</h3>
  663. <p>Checks out a package/module from a <a href="http://www.cyclic.com/">CVS</a>
  664. repository.</p>
  665. <p>When doing automated builds, the <a href="#get">get task</a> should be
  666. preferred, because of speed.</p>
  667. <h3>Parameters</h3>
  668. <table border="1" cellpadding="2" cellspacing="0">
  669. <tr>
  670. <td valign="top"><b>Attribute</b></td>
  671. <td valign="top"><b>Description</b></td>
  672. <td align="center" valign="top"><b>Required</b></td>
  673. </tr>
  674. <tr>
  675. <td valign="top">cvsRoot</td>
  676. <td valign="top">the CVSROOT variable.</td>
  677. <td align="center" valign="top">Yes</td>
  678. </tr>
  679. <tr>
  680. <td valign="top">dest</td>
  681. <td valign="top">the directory where the checked out files should be placed.</td>
  682. <td align="center" valign="top">Yes</td>
  683. </tr>
  684. <tr>
  685. <td valign="top">package</td>
  686. <td valign="top">the package/module to check out.</td>
  687. <td align="center" valign="top">Yes</td>
  688. </tr>
  689. <tr>
  690. <td valign="top">tag</td>
  691. <td valign="top">the tag of the package/module to check out.</td>
  692. <td align="center" valign="top">No</td>
  693. </tr>
  694. </table>
  695. <h3>Examples</h3>
  696. <pre> &lt;cvs cvsRoot=&quot;:pserver:anoncvs@jakarta.apache.org:/home/cvspublic&quot;
  697. package=&quot;jakarta-tools&quot;
  698. dest=&quot;${ws.dir}&quot;
  699. /&gt;</pre>
  700. <p>checks out the package/module &quot;jakarta-tools&quot; from the CVS
  701. repository pointed to by the cvsRoot attribute, and stores the files in &quot;${ws.dir}&quot;.</p>
  702. <hr>
  703. <h2><a name="delete">Delete</a></h2>
  704. <h3>Description</h3>
  705. <p>Deletes a single file.</p>
  706. <h3>Parameters</h3>
  707. <table border="1" cellpadding="2" cellspacing="0">
  708. <tr>
  709. <td valign="top"><b>Attribute</b></td>
  710. <td valign="top"><b>Description</b></td>
  711. <td align="center" valign="top"><b>Required</b></td>
  712. </tr>
  713. <tr>
  714. <td valign="top">file</td>
  715. <td valign="top">the file to delete.</td>
  716. <td valign="top" align="center">Yes</td>
  717. </tr>
  718. </table>
  719. <h3>Examples</h3>
  720. <pre> &lt;delete file=&quot;/lib/ant.jar&quot; /&gt;</pre>
  721. <p>deletes the file <code>/lib/ant.jar</code>.</p>
  722. <pre> &lt;delete file=&quot;${ant}&quot; /&gt;</pre>
  723. <p>deletes the file <code>${ant}</code>.</p>
  724. <hr>
  725. <h2><a name="deltree">Deltree</a></h2>
  726. <h3>Description</h3>
  727. <p>Deletes a directory with all its files and subdirectories.</p>
  728. <h3>Parameters</h3>
  729. <table border="1" cellpadding="2" cellspacing="0">
  730. <tr>
  731. <td valign="top"><b>Attribute</b></td>
  732. <td valign="top"><b>Description</b></td>
  733. <td align="center" valign="top"><b>Required</b></td>
  734. </tr>
  735. <tr>
  736. <td valign="top">dir</td>
  737. <td valign="top">the directory to delete.</td>
  738. <td valign="top" align="center">Yes</td>
  739. </tr>
  740. </table>
  741. <h3>Examples</h3>
  742. <pre> &lt;deltree dir=&quot;dist&quot; /&gt;</pre>
  743. <p>deletes the directory <code>dist</code>, including its files and
  744. subdirectories.</p>
  745. <pre> &lt;deltree dir=&quot;${dist}&quot; /&gt;</pre>
  746. <p>deletes the directory <code>${dist}</code>, including its files and
  747. subdirectories.</p>
  748. <hr>
  749. <h2><a name="echo">Echo</a></h2>
  750. <h3>Description</h3>
  751. <p>Echoes a message to System.out.</p>
  752. <h3>Parameters</h3>
  753. <table border="1" cellpadding="2" cellspacing="0">
  754. <tr>
  755. <td valign="top"><b>Attribute</b></td>
  756. <td valign="top"><b>Description</b></td>
  757. <td align="center" valign="top"><b>Required</b></td>
  758. </tr>
  759. <tr>
  760. <td valign="top">message</td>
  761. <td valign="top">the message to echo.</td>
  762. <td valign="top" align="center">Yes</td>
  763. </tr>
  764. </table>
  765. <h3>Examples</h3>
  766. <pre> &lt;echo message=&quot;Hello world&quot; /&gt;</pre>
  767. <hr>
  768. <h2><a name="exec">Exec</a></h2>
  769. <h3>Description</h3>
  770. <p>Executes a system command. When the <i>os</i> attribute is specified, then
  771. the command is only executed when Ant is run on one of the specified operating
  772. systems.</p>
  773. <h3>Parameters</h3>
  774. <table border="1" cellpadding="2" cellspacing="0">
  775. <tr>
  776. <td valign="top"><b>Attribute</b></td>
  777. <td valign="top"><b>Description</b></td>
  778. <td align="center" valign="top"><b>Required</b></td>
  779. </tr>
  780. <tr>
  781. <td valign="top">command</td>
  782. <td valign="top">the command to execute.</td>
  783. <td align="center" valign="top">Yes</td>
  784. </tr>
  785. <tr>
  786. <td valign="top">dir</td>
  787. <td valign="top">the directory in which the command should be executed.</td>
  788. <td align="center" valign="top">Yes</td>
  789. </tr>
  790. <tr>
  791. <td valign="top">os</td>
  792. <td valign="top">list of Operating Systems on which the command may be
  793. executed.</td>
  794. <td align="center" valign="top">No</td>
  795. </tr>
  796. <tr>
  797. <td valign="top">output</td>
  798. <td valign="top">the file to which the output of the command should be
  799. redirected.</td>
  800. <td align="center" valign="top">Yes</td>
  801. </tr>
  802. </table>
  803. <h3>Examples</h3>
  804. <blockquote>
  805. <p><code>&lt;exec dir=&quot;${src}&quot; command=&quot;dir&quot; os=&quot;windows&quot;
  806. output=&quot;dir.txt&quot; /&gt;</code></p>
  807. </blockquote>
  808. <hr>
  809. <h2><a name="expand">Expand</a></h2>
  810. <h3>Description</h3>
  811. <p>Unzips a zipfile.</p>
  812. <h3>Parameters</h3>
  813. <table border="1" cellpadding="2" cellspacing="0">
  814. <tr>
  815. <td valign="top"><b>Attribute</b></td>
  816. <td valign="top"><b>Description</b></td>
  817. <td align="center" valign="top"><b>Required</b></td>
  818. </tr>
  819. <tr>
  820. <td valign="top">src</td>
  821. <td valign="top">zipfile to expand.</td>
  822. <td align="center" valign="top">Yes</td>
  823. </tr>
  824. <tr>
  825. <td valign="top">dest</td>
  826. <td valign="top">directory where to store the expanded files.</td>
  827. <td align="center" valign="top">Yes</td>
  828. </tr>
  829. </table>
  830. <h3>Examples</h3>
  831. <blockquote>
  832. <p><code>&lt;expand src=&quot;${tomcat_src}/tools-src.zip&quot; dest=&quot;${tools.home}&quot;
  833. /&gt;</code></p>
  834. </blockquote>
  835. <hr>
  836. <h2><a name="get">Get</a></h2>
  837. <h3>Description</h3>
  838. <p>Gets a file from an URL. When the verbose option is &quot;on&quot;, this task
  839. displays a '.' for every 100 Kb retrieved.</p>
  840. <p>This task should be preferred above the <a href="#cvs">CVS task</a> when
  841. doing automated builds. CVS is significant slower than loading a compressed
  842. archive with http/ftp.</p>
  843. <h3>Parameters</h3>
  844. <table border="1" cellpadding="2" cellspacing="0">
  845. <tr>
  846. <td valign="top"><b>Attribute</b></td>
  847. <td valign="top"><b>Description</b></td>
  848. <td align="center" valign="top"><b>Required</b></td>
  849. </tr>
  850. <tr>
  851. <td valign="top">src</td>
  852. <td valign="top">the URL from which to retrieve a file.</td>
  853. <td align="center" valign="top">Yes</td>
  854. </tr>
  855. <tr>
  856. <td valign="top">dest</td>
  857. <td valign="top">the file where to store the retrieved file.</td>
  858. <td align="center" valign="top">Yes</td>
  859. </tr>
  860. <tr>
  861. <td valign="top">verbose</td>
  862. <td valign="top">show verbose information (&quot;on&quot;/&quot;off&quot;).</td>
  863. <td align="center" valign="top">No</td>
  864. </tr>
  865. </table>
  866. <h3>Examples</h3>
  867. <pre> &lt;get src=&quot;http://jakarta.apache.org/&quot; dest=&quot;help/index.html&quot; /&gt;</pre>
  868. <p>gets the index page of http://jakarta.apache.org/, and stores it in the file <code>help/index.html</code>.</p>
  869. <hr>
  870. <h2><a name="gzip">GZip</a></h2>
  871. <h3>Description</h3>
  872. <p>GZips a file.</p>
  873. <h3>Parameters</h3>
  874. <table border="1" cellpadding="2" cellspacing="0">
  875. <tr>
  876. <td valign="top"><b>Attribute</b></td>
  877. <td valign="top"><b>Description</b></td>
  878. <td align="center" valign="top"><b>Required</b></td>
  879. </tr>
  880. <tr>
  881. <td valign="top">src</td>
  882. <td valign="top">the file to gzip.</td>
  883. <td align="center" valign="top">Yes</td>
  884. </tr>
  885. <tr>
  886. <td valign="top">zipfile</td>
  887. <td valign="top">the destination file.</td>
  888. <td align="center" valign="top">Yes</td>
  889. </tr>
  890. </table>
  891. <h3>Examples</h3>
  892. <blockquote>
  893. <p><code>&lt;gzip src=&quot;test.tar&quot; zipfile=&quot;test.tar.gz&quot;
  894. /&gt;</code></p>
  895. </blockquote>
  896. <hr>
  897. <h2><a name="jar">Jar</a></h2>
  898. <h3>Description</h3>
  899. <p>Jars a set of files.</p>
  900. <p>The <i>basedir</i> attribute is the reference directory from where to jar.</p>
  901. <p>It is possible to refine the set of files that are being jarred. This can be
  902. done with the <i>includes</i>, <i>excludes</i> and <i>defaultexcludes</i>
  903. attributes. With the <i>includes</i> attribute you specify the files you want to
  904. have included by using patterns. The <i>exclude</i> attribute is used to specify
  905. the files you want to have excluded. This is also done with patterns. And
  906. finally with the <i>defaultexcludes</i> attribute, you can specify whether you
  907. want to use default exclusions or not. See the section on <a
  908. href="#directorybasedtasks">directory based tasks</a>, on how the
  909. inclusion/exclusion of files works, and how to write patterns. The patterns are
  910. relative to the <i>basedir</i> directory.</p>
  911. <p>The <i>includes</i>, <i>excludes</i> and <i>defaultexcludes</i> attributes
  912. replace the <i>items</i> and <i>ignore</i> attributes. The following explains
  913. how the deprecated <i>items</i> and <i>ignore</i> attribute behave.</p>
  914. <p>When &quot;*&quot; is used for <i>items</i>, all files in the basedir, and
  915. its subdirectories, will be jarred. Otherwise all the files and directories
  916. mentioned in the items list will jarred. When a directory is specified, then all
  917. files within it are also jarred.</p>
  918. <p>With the <i>ignore</i> attribute, you can specify files or directories to
  919. ignore. These files will not be jarred. The items in the <i>ignore</i> attribute
  920. override the items in the <i>items</i> attribute. The names specified in the <i>ignore</i>
  921. attribute are just names, they do not contain any path information!</p>
  922. <h3>Parameters</h3>
  923. <table border="1" cellpadding="2" cellspacing="0">
  924. <tr>
  925. <td valign="top"><b>Attribute</b></td>
  926. <td valign="top"><b>Description</b></td>
  927. <td align="center" valign="top"><b>Required</b></td>
  928. </tr>
  929. <tr>
  930. <td valign="top">jarfile</td>
  931. <td valign="top">the jar-file to create.</td>
  932. <td valign="top" align="center">Yes</td>
  933. </tr>
  934. <tr>
  935. <td valign="top">basedir</td>
  936. <td valign="top">the directory from which to jar the files.</td>
  937. <td valign="top" align="center">Yes</td>
  938. </tr>
  939. <tr>
  940. <td valign="top">items</td>
  941. <td valign="top">a comma separated list of the files/directories to jar. All
  942. files are included when omitted. (<b>deprecated</b>, use <i>includes</i>
  943. instead).</td>
  944. <td valign="top" align="center">No</td>
  945. </tr>
  946. <tr>
  947. <td valign="top">ignore</td>
  948. <td valign="top">comma separated list of filenames/directorynames to exclude
  949. from the jar. No files (except default excludes) are excluded when
  950. omitted. (<b>deprecated</b>, use <i>excludes</i> instead).</td>
  951. <td valign="top" align="center">No</td>
  952. </tr>
  953. <tr>
  954. <td valign="top">includes</td>
  955. <td valign="top">comma separated list of patterns of files that must be
  956. included. All files are included when omitted.</td>
  957. <td valign="top" align="center">No</td>
  958. </tr>
  959. <tr>
  960. <td valign="top">excludes</td>
  961. <td valign="top">comma separated list of patterns of files that must be
  962. excluded. No files (except default excludes) are excluded when omitted.</td>
  963. <td valign="top" align="center">No</td>
  964. </tr>
  965. <tr>
  966. <td valign="top">defaultexcludes</td>
  967. <td valign="top">indicates whether default excludes should be used or not
  968. (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when omitted.</td>
  969. <td valign="top" align="center">No</td>
  970. </tr>
  971. <tr>
  972. <td valign="top">manifest</td>
  973. <td valign="top">the manifest file to use.</td>
  974. <td valign="top" align="center">No</td>
  975. </tr>
  976. </table>
  977. <h3>Examples</h3>
  978. <pre> &lt;jar jarfile=&quot;${dist}/lib/app.jar&quot; basedir=&quot;${build}/classes&quot; /&gt;</pre>
  979. <p>jars all files in the <code>${build}/classes</code> directory in a file
  980. called <code>app.jar</code> in the <code>${dist}/lib</code> directory.</p>
  981. <pre> &lt;jar jarfile=&quot;${dist}/lib/app.jar&quot;
  982. basedir=&quot;${build}/classes&quot;
  983. excludes=&quot;**/Test.class&quot;
  984. /&gt;</pre>
  985. <p>jars all files in the <code>${build}/classes</code> directory in a file
  986. called <code>app.jar</code> in the <code>${dist}/lib</code> directory. Files
  987. with the name <code>Test.class</code> are excluded.</p>
  988. <pre> &lt;jar jarfile=&quot;${dist}/lib/app.jar&quot;
  989. basedir=&quot;${build}/classes&quot;
  990. includes=&quot;mypackage/test/**&quot;
  991. excludes=&quot;**/Test.class&quot;
  992. /&gt;</pre>
  993. <p>jars all files in the <code>${build}/classes</code> directory in a file
  994. called <code>app.jar</code> in the <code>${dist}/lib</code> directory. Only
  995. files under the directory <code>mypackage/test</code> are used, and files with
  996. the name <code>Test.class</code> are excluded.</p>
  997. <h3>Deprecated examples</h3>
  998. <pre> &lt;jar jarfile=&quot;${dist}/lib/app.jar&quot; basedir=&quot;${build}/classes&quot; items=&quot;*&quot; /&gt;</pre>
  999. <p>jars all files in the <code>${build}/classes</code> directory in a file
  1000. called <code>app.jar</code> in the <code>${dist}/lib</code> directory.</p>
  1001. <pre> &lt;jar jarfile=&quot;${dist}/lib/app.jar&quot; basedir=&quot;${build}/classes&quot; items=&quot;*&quot; ignore=&quot;Test.class&quot; /&gt;</pre>
  1002. <p>jars all files in the <code>${build}/classes</code> directory in a file
  1003. called <code>app.jar</code> in the <code>${dist}/lib</code> directory.
  1004. Files/directories with the name <code>Test.class</code> are excluded.</p>
  1005. <hr>
  1006. <h2><a name="java">Java</a></h2>
  1007. <h3>Description</h3>
  1008. <p>Executes a Java class within the running (Ant) VM or forks another VM if
  1009. specified.</p>
  1010. <p>Be careful that the executed class doesn't call System.exit(), because it
  1011. will terminate the VM and thus Ant. In case this happens, it's highly suggested
  1012. that you set the fork attribute so that System.exit() stops the other VM and not
  1013. the one that is currently running Ant.</p>
  1014. <h3>Parameters</h3>
  1015. <table border="1" cellpadding="2" cellspacing="0">
  1016. <tr>
  1017. <td valign="top"><b>Attribute</b></td>
  1018. <td valign="top"><b>Description</b></td>
  1019. <td align="center" valign="top"><b>Required</b></td>
  1020. </tr>
  1021. <tr>
  1022. <td valign="top">class</td>
  1023. <td valign="top">the Java class to execute.</td>
  1024. <td align="center" valign="top">Yes</td>
  1025. </tr>
  1026. <tr>
  1027. <td valign="top">args</td>
  1028. <td valign="top">the arguments for the class that is executed.</td>
  1029. <td align="center" valign="top">No</td>
  1030. </tr>
  1031. <tr>
  1032. <td valign="top">fork</td>
  1033. <td valign="top">if enabled triggers the class execution in another VM
  1034. (disabled by default)</td>
  1035. <td align="center" valign="top">No</td>
  1036. </tr>
  1037. <tr>
  1038. <td valign="top">jvmargs</td>
  1039. <td valign="top">the arguments to pass to the forked VM (ignored if fork is
  1040. disabled)</td>
  1041. <td align="center" valign="top">No</td>
  1042. </tr>
  1043. </table>
  1044. <h3>Examples</h3>
  1045. <pre> &lt;java class=&quot;test.Main&quot; /&gt;</pre>
  1046. <pre> &lt;java class=&quot;test.Main&quot; args=&quot;-h&quot; /&gt;</pre>
  1047. <pre> &lt;java class=&quot;test.Main&quot;
  1048. args=&quot;-h&quot;
  1049. fork=&quot;yes&quot;
  1050. jvmargs=&quot;-Xrunhprof:cpu=samples,file=log.txt,depth=3&quot;
  1051. /&gt;</pre>
  1052. <hr>
  1053. <h2><a name="javac">Javac</a></h2>
  1054. <h3>Description</h3>
  1055. <p>Compiles a source tree within the running (Ant) VM.</p>
  1056. <p>The source and destination directory will be recursively scanned for Java
  1057. source files to compile. Only Java files that have no corresponding class file
  1058. or where the class file is older than the java file will be compiled.</p>
  1059. <p>Files in the source tree, that are no java files, are copied to the
  1060. destination directory, allowing support files to be located properly in the
  1061. classpath.</p>
  1062. <p>The directory structure of the source tree should follow the package
  1063. hierarchy.</p>
  1064. <p>It is possible to refine the set of files that are being compiled/copied.
  1065. This can be done with the <i>includes</i>, <i>excludes</i> and <i>defaultexcludes</i>
  1066. attributes. With the <i>includes</i> attribute you specify the files you want to
  1067. have included by using patterns. The <i>exclude</i> attribute is used to specify
  1068. the files you want to have excluded. This is also done with patterns. And
  1069. finally with the <i>defaultexcludes</i> attribute, you can specify whether you
  1070. want to use default exclusions or not. See the section on <a
  1071. href="#directorybasedtasks">directory based tasks</a>, on how the
  1072. inclusion/exclusion of files works, and how to write patterns. The patterns are
  1073. relative to the <i>srcdir</i> directory.</p>
  1074. <p>It is possible to use different compilers. This can be selected with the
  1075. &quot;build.compiler&quot; property. There are three choices:</p>
  1076. <ul>
  1077. <li>classic (the standard compiler of JDK 1.1/1.2)</li>
  1078. <li>modern (the new compiler of JDK 1.3)</li>
  1079. <li>jikes (the <a
  1080. href="http://oss.software.ibm.com/developerworks/opensource/jikes/project">Jikes</a>
  1081. compiler)</li>
  1082. </ul>
  1083. <p>For JDK 1.1/1.2 is classic the default. For JDK 1.3 is modern the default.</p>
  1084. <h3>Parameters</h3>
  1085. <table border="1" cellpadding="2" cellspacing="0">
  1086. <tr>
  1087. <td valign="top"><b>Attribute</b></td>
  1088. <td valign="top"><b>Description</b></td>
  1089. <td align="center" valign="top"><b>Required</b></td>
  1090. </tr>
  1091. <tr>
  1092. <td valign="top">srcdir</td>
  1093. <td valign="top">location of the java files.</td>
  1094. <td align="center" valign="top">Yes</td>
  1095. </tr>
  1096. <tr>
  1097. <td valign="top">destdir</td>
  1098. <td valign="top">location where to store the class files.</td>
  1099. <td align="center" valign="top">Yes</td>
  1100. </tr>
  1101. <tr>
  1102. <td valign="top">includes</td>
  1103. <td valign="top">comma separated list of patterns of files that must be
  1104. included. All files are included when omitted.</td>
  1105. <td valign="top" align="center">No</td>
  1106. </tr>
  1107. <tr>
  1108. <td valign="top">excludes</td>
  1109. <td valign="top">comma separated list of patterns of files that must be
  1110. excluded. No files (except default excludes) are excluded when omitted.</td>
  1111. <td valign="top" align="center">No</td>
  1112. </tr>
  1113. <tr>
  1114. <td valign="top">defaultexcludes</td>
  1115. <td valign="top">indicates whether default excludes should be used or not
  1116. (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when omitted.</td>
  1117. <td valign="top" align="center">No</td>
  1118. </tr>
  1119. <tr>
  1120. <td valign="top">classpath</td>
  1121. <td valign="top">the classpath to use.</td>
  1122. <td align="center" valign="top">No</td>
  1123. </tr>
  1124. <tr>
  1125. <td valign="top">bootclasspath</td>
  1126. <td valign="top">location of bootstrap class files.</td>
  1127. <td align="center" valign="top">No</td>
  1128. </tr>
  1129. <tr>
  1130. <td valign="top">extdirs</td>
  1131. <td valign="top">location of installed extensions.</td>
  1132. <td align="center" valign="top">No</td>
  1133. </tr>
  1134. <tr>
  1135. <td valign="top">debug</td>
  1136. <td valign="top">indicates whether there should be compiled with debug
  1137. information (&quot;on&quot;).</td>
  1138. <td align="center" valign="top">No</td>
  1139. </tr>
  1140. <tr>
  1141. <td valign="top">optimize</td>
  1142. <td valign="top">indicates whether there should be compiled with
  1143. optimization (&quot;on&quot;).</td>
  1144. <td align="center" valign="top">No</td>
  1145. </tr>
  1146. <tr>
  1147. <td valign="top">deprecation</td>
  1148. <td valign="top">indicates whether there should be compiled with deprecation
  1149. information (&quot;on&quot;).</td>
  1150. <td align="center" valign="top">No</td>
  1151. </tr>
  1152. </table>
  1153. <h3>Examples</h3>
  1154. <pre> &lt;javac srcdir=&quot;${src}&quot;
  1155. destdir=&quot;${build}&quot;
  1156. classpath=&quot;xyz.jar&quot;
  1157. debug=&quot;on&quot;
  1158. /&gt;</pre>
  1159. <p>compiles all .java files under the directory <code>${src}</code>, and stores
  1160. the .class files in the directory <code>${build}</code>. It also copies the non-java
  1161. files from the tree under <code>${src}</code> to the tree under <code>${build}</code>.
  1162. The classpath used contains <code>xyz.jar</code>, and debug information is on.</p>
  1163. <pre> &lt;javac srcdir=&quot;${src}&quot;
  1164. destdir=&quot;${build}&quot;
  1165. includes=&quot;mypackage/p1/**,mypackage/p2/**&quot;
  1166. excludes=&quot;mypackage/p1/testpackage/**&quot;
  1167. classpath=&quot;xyz.jar&quot;
  1168. debug=&quot;on&quot;
  1169. /&gt;</pre>
  1170. <p>compiles .java files under the directory <code>${src}</code>, and stores the
  1171. .class files in the directory <code>${build}</code>. It also copies the non-java
  1172. files from the tree under <code>${src}</code> to the tree under <code>${build}</code>.
  1173. The classpath used contains <code>xyz.jar</code>, and debug information is on.
  1174. Only files under <code>mypackage/p1</code> and <code>mypackage/p2</code> are
  1175. used. Files in the <code>mypackage/p1/testpackage</code> directory are excluded
  1176. form compilation and copy.</p>
  1177. <hr>
  1178. <h2><a name="javadoc">Javadoc/Javadoc2</a></h2>
  1179. <h3>Description</h3>
  1180. <p>Generates code documentation using the javadoc tool.</p>
  1181. <p>The source directory will be recursively scanned for Java source files to but
  1182. only those matching the inclusion rules will be passed to the javadoc tool. This
  1183. allows wildcards to be used to choose between package names, reducing verbosity
  1184. and management costs over time. This task, however, has no notion of
  1185. &quot;changed&quot; files, unlike the <a href="#javac">javac</a> task, but it's
  1186. not used so frequently.</p>
  1187. <p>This task works seamlessly between different javadoc versions (1.1 and 1.2),
  1188. with the obvious restriction that the 1.2 attributes will be ignored if run in a
  1189. 1.1 VM.</p>
  1190. <p>NOTE: since javadoc calls System.exit(), we cannot run javadoc inside the
  1191. same VM without breaking functionality. For this reason, this task always forks
  1192. the VM. But this is not a performance penalty since javadoc is normally a heavy
  1193. application and must be called just once.</p>
  1194. <p>DEPRECATION: the javadoc2 task simply points to the javadoc task and it's
  1195. there for back compatibility reasons. Since this task will be removed in future
  1196. versions, you are strongly encouraged to use <a href="#javadoc">javadoc</a>
  1197. instead.</p>
  1198. <h3>Parameters</h3>
  1199. <table border="1" cellpadding="2" cellspacing="0">
  1200. <tr>
  1201. <td valign="top"><b>Attribute</b></td>
  1202. <td valign="top"><b>Description</b></td>
  1203. <td align="center" valign="top"><b>Availability</b></td>
  1204. <td align="center" valign="top"><b>Required</b></td>
  1205. </tr>
  1206. <tr>
  1207. <td valign="top">sourcepath</td>
  1208. <td valign="top">Specify where to find source files</td>
  1209. <td align="center" valign="top">all</td>
  1210. <td align="center" valign="top">yes</td>
  1211. </tr>
  1212. <tr>
  1213. <td valign="top">destdir</td>
  1214. <td valign="top">Destination directory for output files</td>
  1215. <td align="center" valign="top">all</td>
  1216. <td align="center" valign="top">yes</td>
  1217. </tr>
  1218. <tr>
  1219. <td valign="top">sourcefiles</td>
  1220. <td valign="top">Space separated list of source files</td>
  1221. <td align="center" valign="top">all</td>
  1222. <td align="center" valign="middle" rowspan="2">at least one of the two</td>
  1223. </tr>
  1224. <tr>
  1225. <td valign="top">packagenames</td>
  1226. <td valign="top">Space separated list of package files (with terminating
  1227. wildcard)</td>
  1228. <td align="center" valign="top">all</td>
  1229. </tr>
  1230. <tr>
  1231. <td valign="top">Classpath</td>
  1232. <td valign="top">Specify where to find user class files</td>
  1233. <td align="center" valign="top">all</td>
  1234. <td align="center" valign="top">no</td>
  1235. </tr>
  1236. <tr>
  1237. <td valign="top">Bootclasspath</td>
  1238. <td valign="top">Override location of class files loaded by the bootstrap
  1239. class loader</td>
  1240. <td align="center" valign="top">1.2</td>
  1241. <td align="center" valign="top">no</td>
  1242. </tr>
  1243. <tr>
  1244. <td valign="top">Extdirs</td>
  1245. <td valign="top">Override location of installed extensions</td>
  1246. <td align="center" valign="top">1.2</td>
  1247. <td align="center" valign="top">no</td>
  1248. </tr>
  1249. <tr>
  1250. <td valign="top">Overview</td>
  1251. <td valign="top">Read overview documentation from HTML file</td>
  1252. <td align="center" valign="top">1.2</td>
  1253. <td align="center" valign="top">no</td>
  1254. </tr>
  1255. <tr>
  1256. <td valign="top">Public</td>
  1257. <td valign="top">Show only public classes and members</td>
  1258. <td align="center" valign="top">all</td>
  1259. <td align="center" valign="top">no</td>
  1260. </tr>
  1261. <tr>
  1262. <td valign="top">Protected</td>
  1263. <td valign="top">Show protected/public classes and members (default)</td>
  1264. <td align="center" valign="top">all</td>
  1265. <td align="center" valign="top">no</td>
  1266. </tr>
  1267. <tr>
  1268. <td valign="top">Package</td>
  1269. <td valign="top">Show package/protected/public classes and members</td>
  1270. <td align="center" valign="top">all</td>
  1271. <td align="center" valign="top">no</td>
  1272. </tr>
  1273. <tr>
  1274. <td valign="top">Private</td>
  1275. <td valign="top">Show all classes and members</td>
  1276. <td align="center" valign="top">all</td>
  1277. <td align="center" valign="top">no</td>
  1278. </tr>
  1279. <tr>
  1280. <td valign="top">Old</td>
  1281. <td valign="top">Generate output using JDK 1.1 emulating doclet</td>
  1282. <td align="center" valign="top">1.2</td>
  1283. <td align="center" valign="top">no</td>
  1284. </tr>
  1285. <tr>
  1286. <td valign="top">Verbose</td>
  1287. <td valign="top">Output messages about what Javadoc is doing</td>
  1288. <td align="center" valign="top">1.2</td>
  1289. <td align="center" valign="top">no</td>
  1290. </tr>
  1291. <tr>
  1292. <td valign="top">Locale</td>
  1293. <td valign="top">Locale to be used, e.g. en_US or en_US_WIN</td>
  1294. <td align="center" valign="top">1.2</td>
  1295. <td align="center" valign="top">no</td>
  1296. </tr>
  1297. <tr>
  1298. <td valign="top">Encoding</td>
  1299. <td valign="top">Source file encoding name</td>
  1300. <td align="center" valign="top">all</td>
  1301. <td align="center" valign="top">no</td>
  1302. </tr>
  1303. <tr>
  1304. <td valign="top">Version</td>
  1305. <td valign="top">Include @version paragraphs</td>
  1306. <td align="center" valign="top">all</td>
  1307. <td align="center" valign="top">no</td>
  1308. </tr>
  1309. <tr>
  1310. <td valign="top">Use</td>
  1311. <td valign="top">Create class and package usage pages</td>
  1312. <td align="center" valign="top">1.2</td>
  1313. <td align="center" valign="top">no</td>
  1314. </tr>
  1315. <tr>
  1316. <td valign="top">Author</td>
  1317. <td valign="top">Include @author paragraphs</td>
  1318. <td align="center" valign="top">all</td>
  1319. <td align="center" valign="top">no</td>
  1320. </tr>
  1321. <tr>
  1322. <td valign="top">Splitindex</td>
  1323. <td valign="top">Split index into one file per letter</td>
  1324. <td align="center" valign="top">1.2</td>
  1325. <td align="center" valign="top">no</td>
  1326. </tr>
  1327. <tr>
  1328. <td valign="top">Windowtitle</td>
  1329. <td valign="top">Browser window title for the documenation (text)</td>
  1330. <td align="center" valign="top">1.2</td>
  1331. <td align="center" valign="top">no</td>
  1332. </tr>
  1333. <tr>
  1334. <td valign="top">Doctitle</td>
  1335. <td valign="top">Include title for the package index(first) page (html-code)</td>
  1336. <td align="center" valign="top">1.2</td>
  1337. <td align="center" valign="top">no</td>
  1338. </tr>
  1339. <tr>
  1340. <td valign="top">Header</td>
  1341. <td valign="top">Include header text for each page (html-code)</td>
  1342. <td align="center" valign="top">1.2</td>
  1343. <td align="center" valign="top">no</td>
  1344. </tr>
  1345. <tr>
  1346. <td valign="top">Footer</td>
  1347. <td valign="top">Include footer text for each page (html-code)</td>
  1348. <td align="center" valign="top">1.2</td>
  1349. <td align="center" valign="top">no</td>
  1350. </tr>
  1351. <tr>
  1352. <td valign="top">bottom</td>
  1353. <td valign="top">Include bottom text for each page (html-code)</td>
  1354. <td align="center" valign="top">1.2</td>
  1355. <td align="center" valign="top">no</td>
  1356. </tr>
  1357. <tr>
  1358. <td valign="top">link</td>
  1359. <td valign="top">Create links to javadoc output at the given URL</td>
  1360. <td align="center" valign="top">1.2</td>
  1361. <td align="center" valign="top">no</td>
  1362. </tr>
  1363. <tr>
  1364. <td valign="top">linkoffline</td>
  1365. <td valign="top">Link to docs at &lt;url&gt; using package list at
  1366. &lt;url2&gt;</td>
  1367. <td align="center" valign="top">1.2</td>
  1368. <td align="center" valign="top">no</td>
  1369. </tr>
  1370. <tr>
  1371. <td valign="top">group</td>
  1372. <td valign="top">Group specified packages together in overview page</td>
  1373. <td align="center" valign="top">1.2</td>
  1374. <td align="center" valign="top">no</td>
  1375. </tr>
  1376. <tr>
  1377. <td valign="top">nodeprecated</td>
  1378. <td valign="top">Do not include @deprecated information</td>
  1379. <td align="center" valign="top">all</td>
  1380. <td align="center" valign="top">no</td>
  1381. </tr>
  1382. <tr>
  1383. <td valign="top">nodeprecatedlist</td>
  1384. <td valign="top">Do not generate deprecated list</td>
  1385. <td align="center" valign="top">1.2</td>
  1386. <td align="center" valign="top">no</td>
  1387. </tr>
  1388. <tr>
  1389. <td valign="top">notree</td>
  1390. <td valign="top">Do not generate class hierarchy</td>
  1391. <td align="center" valign="top">all</td>
  1392. <td align="center" valign="top">no</td>
  1393. </tr>
  1394. <tr>
  1395. <td valign="top">noindex</td>
  1396. <td valign="top">Do not generate index</td>
  1397. <td align="center" valign="top">all</td>
  1398. <td align="center" valign="top">no</td>
  1399. </tr>
  1400. <tr>
  1401. <td valign="top">nohelp</td>
  1402. <td valign="top">Do not generate help link</td>
  1403. <td align="center" valign="top">1.2</td>
  1404. <td align="center" valign="top">no</td>
  1405. </tr>
  1406. <tr>
  1407. <td valign="top">nonavbar</td>
  1408. <td valign="top">Do not generate navigation bar</td>
  1409. <td align="center" valign="top">1.2</td>
  1410. <td align="center" valign="top">no</td>
  1411. </tr>
  1412. <tr>
  1413. <td valign="top">serialwarn</td>
  1414. <td valign="top">Generate warning about @serial tag</td>
  1415. <td align="center" valign="top">1.2</td>
  1416. <td align="center" valign="top">no</td>
  1417. </tr>
  1418. <tr>
  1419. <td valign="top">helpfile</td>
  1420. <td valign="top">Specifies the HTML help file to use</td>
  1421. <td align="center" valign="top">1.2</td>
  1422. <td align="center" valign="top">no</td>
  1423. </tr>
  1424. <tr>
  1425. <td valign="top">stylesheetfile</td>
  1426. <td valign="top">Specifies the CSS stylesheet to use</td>
  1427. <td align="center" valign="top">1.2</td>
  1428. <td align="center" valign="top">no</td>
  1429. </tr>
  1430. <tr>
  1431. <td valign="top">charset</td>
  1432. <td valign="top">Charset for cross-platform viewing of generated
  1433. documentation</td>
  1434. <td align="center" valign="top">1.2</td>
  1435. <td align="center" valign="top">no</td>
  1436. </tr>
  1437. <tr>
  1438. <td valign="top">docencoding</td>
  1439. <td valign="top">Output file encoding name</td>
  1440. <td align="center" valign="top">1.1</td>
  1441. <td align="center" valign="top">no</td>
  1442. </tr>
  1443. </table>
  1444. <h3>Examples</h3>
  1445. <pre> &lt;javadoc packagenames=&quot;com.dummy.test.*&quot;
  1446. sourcepath=&quot;src&quot;
  1447. destdir=&quot;docs/api&quot;
  1448. author=&quot;true&quot;
  1449. version=&quot;true&quot;
  1450. use=&quot;true&quot;
  1451. windowtitle=&quot;Test API&quot;
  1452. doctitle=&quot;&lt;h1&gt;Test&lt;/h1&gt;&quot;
  1453. bottom=&quot;&lt;i&gt;Copyright &amp;#169; 2000 Dummy Corp. All Rights Reserved.&lt;/i&gt;&quot;
  1454. /&gt;</pre>
  1455. <hr>
  1456. <h2><a name="keysubst">KeySubst</a></h2>
  1457. <h3>Description</h3>
  1458. <p>Performs keyword substitution in the source file, and writes the result to
  1459. the destination file.</p>
  1460. <p>Keys in the source file are of the form ${keyname}. The <i>keys</i> attribute
  1461. contains key/value pairs. When a key is found in the <i>keys</i> attribute, then
  1462. &quot;${keyname}&quot; is replaced by the corresponding value.</p>
  1463. <p>The <i>keys</i> attribute is of the form
  1464. &quot;name1=value1*name2=value2*name3=value3&quot;. The '*' is called the
  1465. separator, which might we changed with the <i>sep</i> attribute.</p>
  1466. <p>Note: the source file and destination file may not be the same.</p>
  1467. <h3>Parameters</h3>
  1468. <table border="1" cellpadding="2" cellspacing="0">
  1469. <tr>
  1470. <td valign="top"><b>Attribute</b></td>
  1471. <td valign="top"><b>Description</b></td>
  1472. <td align="center" valign="top"><b>Required</b></td>
  1473. </tr>
  1474. <tr>
  1475. <td valign="top">src</td>
  1476. <td valign="top">the source file.</td>
  1477. <td align="center" valign="top">Yes</td>
  1478. </tr>
  1479. <tr>
  1480. <td valign="top">dest</td>
  1481. <td valign="top">the destination file.</td>
  1482. <td align="center" valign="top">Yes</td>
  1483. </tr>
  1484. <tr>
  1485. <td valign="top">sep</td>
  1486. <td valign="top">the separator for the name/value pairs.</td>
  1487. <td align="center" valign="top">No</td>
  1488. </tr>
  1489. <tr>
  1490. <td valign="top">keys</td>
  1491. <td valign="top">name/value pairs for replacement.</td>
  1492. <td align="center" valign="top">Yes</td>
  1493. </tr>
  1494. </table>
  1495. <h3>Examples</h3>
  1496. <pre> &lt;keysubst src=&quot;abc.txt&quot; dest=&quot;def.txt&quot; keys=&quot;VERSION=1.0.3*DATE=2000-01-10&quot; /&gt;</pre>
  1497. <hr>
  1498. <h2><a name="mkdir">Mkdir</a></h2>
  1499. <h3>Description</h3>
  1500. <p>Creates a directory. Also non-existent parent directories are created, when
  1501. necessary.</p>
  1502. <h3>Parameters</h3>
  1503. <table border="1" cellpadding="2" cellspacing="0">
  1504. <tr>
  1505. <td valign="top"><b>Attribute</b></td>
  1506. <td valign="top"><b>Description</b></td>
  1507. <td align="center" valign="top"><b>Required</b></td>
  1508. </tr>
  1509. <tr>
  1510. <td valign="top">dir</td>
  1511. <td valign="top">the directory to create.</td>
  1512. <td align="center" valign="top">Yes</td>
  1513. </tr>
  1514. </table>
  1515. <h3>Examples</h3>
  1516. <pre>&lt;mkdir dir=&quot;${dist}&quot; /&gt;</pre>
  1517. <p>creates a directory <code>${dist}</code>.</p>
  1518. <pre>&lt;mkdir dir=&quot;${dist}/lib&quot; /&gt;</pre>
  1519. <p>creates a directory <code>${dist}/lib</code>.</p>
  1520. <hr>
  1521. <h2><a name="property">Property</a></h2>
  1522. <h3>Description</h3>
  1523. <p>Sets a property (by name and value), or set of properties (from file or
  1524. resource) in the project.</p>
  1525. <p>When a property was set by the user, or was a property in a parent project
  1526. (that started this project with the <a href="#ant">ant task</a>), then this
  1527. property cannot be set, and will be ignored. This means that properties set
  1528. outside the current project always override the properties of the current
  1529. project.</p>
  1530. <p>There are three ways to set properties:</p>
  1531. <ul>
  1532. <li>By supplying both the <i>name</i> and <i>value</i> attribute.</li>
  1533. <li>By setting the <i>file</i> attribute with the filename of the property
  1534. file to load. This property file has the format as defined by the file used
  1535. in the class java.util.Properties.</li>
  1536. <li>By setting the <i>resource</i> attribute with the resource name of the
  1537. property file to load. This property file has the format as defined by the
  1538. file used in the class java.util.Properties.</li>
  1539. </ul>
  1540. <p>Although combinations of the three ways are possible, only one should be used
  1541. at a time. Problems might occur with the order in which properties are set, for
  1542. instance.</p>
  1543. <p>The value part of the properties being set, might contain references to other
  1544. properties. These references are resolved at the time these properties are set.
  1545. This also holds for properties loaded from a property file.</p>
  1546. <h3>Parameters</h3>
  1547. <table border="1" cellpadding="2" cellspacing="0">
  1548. <tr>
  1549. <td valign="top"><b>Attribute</b></td>
  1550. <td valign="top"><b>Description</b></td>
  1551. <td align="center" valign="top"><b>Required</b></td>
  1552. </tr>
  1553. <tr>
  1554. <td valign="top">name</td>
  1555. <td valign="top">the name of the property to set.</td>
  1556. <td valign="top" align="center">Yes</td>
  1557. </tr>
  1558. <tr>
  1559. <td valign="top">value</td>
  1560. <td valign="top">the value of the property.</td>
  1561. <td valign="middle" align="center" rowspan="3">Yes</td>
  1562. </tr>
  1563. <tr>
  1564. <td valign="top">resource</td>
  1565. <td valign="top">the resource name of the property file.</td>
  1566. </tr>
  1567. <tr>
  1568. <td valign="top">file</td>
  1569. <td valign="top">the filename of the property file .</td>
  1570. </tr>
  1571. </table>
  1572. <h3>Examples</h3>
  1573. <pre> &lt;property name=&quot;foo.dist&quot; value=&quot;dist&quot; /&gt;</pre>
  1574. <p>sets the property <code>foo.dist</code> to the value &quot;dist&quot;.</p>
  1575. <pre> &lt;property file=&quot;foo.properties&quot; /&gt;</pre>
  1576. <p>reads a set of properties from a file called &quot;foo.properties&quot;.</p>
  1577. <pre> &lt;property resource=&quot;foo.properties&quot; /&gt;</pre>
  1578. <p>reads a set of properties from a resource called &quot;foo.properties&quot;.</p>
  1579. <hr>
  1580. <h2><a name="replace">Replace</a></h2>
  1581. <h3>Description</h3>
  1582. <p>Replaces the occurrence of a given string with another string in a file.</p>
  1583. <h3>Parameters</h3>
  1584. <table border="1" cellpadding="2" cellspacing="0">
  1585. <tr>
  1586. <td valign="top"><b>Attribute</b></td>
  1587. <td valign="top"><b>Description</b></td>
  1588. <td align="center" valign="top"><b>Required</b></td>
  1589. </tr>
  1590. <tr>
  1591. <td valign="top">file</td>
  1592. <td valign="top">file for which the token should be replaced.</td>
  1593. <td valign="top" align="center">Yes</td>
  1594. </tr>
  1595. <tr>
  1596. <td valign="top">token</td>
  1597. <td valign="top">the token which must be replaced.</td>
  1598. <td valign="top" align="center">Yes</td>
  1599. </tr>
  1600. <tr>
  1601. <td valign="top">value</td>
  1602. <td valign="top">the new value for the token. When omitted, an empty string
  1603. (&quot;&quot;) is used.</td>
  1604. <td valign="top" align="center">No</td>
  1605. </tr>
  1606. </table>
  1607. <h3>Examples</h3>
  1608. <pre> &lt;replace file=&quot;${src}/index.html&quot; token=&quot;@@@&quot; value=&quot;wombat&quot; /&gt;</pre>
  1609. <p>replaces occurrences of the string &quot;@@@&quot; with the string
  1610. &quot;wombat&quot;, in the file <code>${src}/index.html</code>.</p>
  1611. <hr>
  1612. <h2><a name="rmic">Rmic</a></h2>
  1613. <h3>Description</h3>
  1614. <p>Runs the rmic compiler for a certain class.</p>
  1615. <h3>Parameters</h3>
  1616. <table border="1" cellpadding="2" cellspacing="0">
  1617. <tr>
  1618. <td valign="top"><b>Attribute</b></td>
  1619. <td valign="top"><b>Description</b></td>
  1620. <td align="center" valign="top"><b>Required</b></td>
  1621. </tr>
  1622. <tr>
  1623. <td valign="top">base</td>
  1624. <td valign="top">the location to store the compiled files.</td>
  1625. <td valign="top" align="center">Yes</td>
  1626. </tr>
  1627. <tr>
  1628. <td valign="top">class</td>
  1629. <td valign="top">the class for which to run <code>rmic</code>.</td>
  1630. <td valign="top" align="center">Yes</td>
  1631. </tr>
  1632. </table>
  1633. <h3>Examples</h3>
  1634. <pre> &lt;rmic class=&quot;com.xyz.FooBar&quot; base=&quot;${build}/classes&quot; /&gt;</pre>
  1635. <p>runs the rmic compiler for the class <code>com.xyz.FooBar</code>. The
  1636. compiled files will be stored in the directory <code>${build}/classes</code>.</p>
  1637. <hr>
  1638. <h2><a name="tar">Tar</a></h2>
  1639. <h3>Description</h3>
  1640. <p>Creates a tar archive.</p>
  1641. <p>The <i>basedir</i> attribute is the reference directory from where to tar.</p>
  1642. <p>It is possible to refine the set of files that are being tarred. This can be
  1643. done with the <i>includes</i>, <i>excludes</i> and <i>defaultexcludes</i>
  1644. attributes. With the <i>includes</i> attribute you specify the files you want to
  1645. have included by using patterns. The <i>exclude</i> attribute is used to specify
  1646. the files you want to have excluded. This is also done with patterns. And
  1647. finally with the <i>defaultexcludes</i> attribute, you can specify whether you
  1648. want to use default exclusions or not. See the section on <a
  1649. href="#directorybasedtasks">directory based tasks</a>, on how the
  1650. inclusion/exclusion of files works, and how to write patterns. The patterns are
  1651. relative to the <i>basedir</i> directory.</p>
  1652. <p>The <i>includes</i>, <i>excludes</i> and <i>defaultexcludes</i> attributes
  1653. replace the <i>items</i> and <i>ignore</i> attributes. The following explains
  1654. how the deprecated <i>items</i> and <i>ignore</i> attribute behave.</p>
  1655. <p>When &quot;*&quot; is used for <i>items</i>, all files in the basedir, and
  1656. its subdirectories, will be tarred. Otherwise all the files and directories
  1657. mentioned in the items list will tarred. When a directory is specified, then all
  1658. files within it are also tarred.</p>
  1659. <p>With the <i>ignore</i> attribute, you can specify files or directories to
  1660. ignore. These files will not be tarred. The items in the <i>ignore</i> attribute
  1661. override the items in the <i>items</i> attribute. The names specified in the <i>ignore</i>
  1662. attribute are just names, they do not contain any path information!</p>
  1663. <p>Note that this task does not perform compression. You might want to use the <a href="#gzip">GZip</a>
  1664. task to come up with a .tar.gz package.</p>
  1665. <h3>Parameters</h3>
  1666. <table border="1" cellpadding="2" cellspacing="0">
  1667. <tr>
  1668. <td valign="top"><b>Attribute</b></td>
  1669. <td valign="top"><b>Description</b></td>
  1670. <td valign="top" align="center"><b>Required</b></td>
  1671. </tr>
  1672. <tr>
  1673. <td valign="top">tarfile</td>
  1674. <td valign="top">the tar-file to create.</td>
  1675. <td align="center" valign="top">Yes</td>
  1676. </tr>
  1677. <tr>
  1678. <td valign="top">basedir</td>
  1679. <td valign="top">the directory from which to zip the files.</td>
  1680. <td align="center" valign="top">Yes</td>
  1681. </tr>
  1682. <tr>
  1683. <td valign="top">includes</td>
  1684. <td valign="top">comma separated list of patterns of files that must be
  1685. included. All files are included when omitted.</td>
  1686. <td valign="top" align="center">No</td>
  1687. </tr>
  1688. <tr>
  1689. <td valign="top">excludes</td>
  1690. <td valign="top">comma separated list of patterns of files that must be
  1691. excluded. No files (except default excludes) are excluded when omitted.</td>
  1692. <td valign="top" align="center">No</td>
  1693. </tr>
  1694. <tr>
  1695. <td valign="top">defaultexcludes</td>
  1696. <td valign="top">indicates whether default excludes should be used or not
  1697. (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when omitted.</td>
  1698. <td valign="top" align="center">No</td>
  1699. </tr>
  1700. </table>
  1701. <h3>Examples</h3>
  1702. <pre> &lt;tar tarfile=&quot;${dist}/manual.tar&quot; basedir=&quot;htdocs/manual&quot; /&gt;
  1703. &lt;gzip zipfile=&quot;${dist}/manual.tar.gz&quot; src=&quot;${dist}/manual.tar&quot; /&gt;</pre>
  1704. <p>tars all files in the <code>htdocs/manual</code> directory in a file called <code>manual.tar</code>
  1705. in the <code>${dist}</code> directory, then applies the gzip task to compress
  1706. it.</p>
  1707. <pre> &lt;tar tarfile=&quot;${dist}/manual.tar&quot;
  1708. basedir=&quot;htdocs/manual&quot;
  1709. excludes=&quot;mydocs/**, **/todo.html&quot;
  1710. /&gt;</pre>
  1711. <p>tars all files in the <code>htdocs/manual</code> directory in a file called <code>manual.tar</code>
  1712. in the <code>${dist}</code> directory. Files in the directory <code>mydocs</code>,
  1713. or files with the name <code>todo.html</code> are excluded.</p>
  1714. <hr>
  1715. <h2><a name="taskdef">Taskdef</a></h2>
  1716. <h3>Description</h3>
  1717. <p>Adds a task definition to the current project, such that this new task can be
  1718. used in the current project. Two attributes are needed, the name that identifies
  1719. this task uniquely, and the full name of the class (including the packages) that
  1720. implements this task.</p>
  1721. <p>Taskdef should be used to add your own tasks to the system. See also &quot;<a
  1722. href="#writingowntask">Writing your own task</a>&quot;.</p>
  1723. <h3>Parameters</h3>
  1724. <table border="1" cellpadding="2" cellspacing="0">
  1725. <tr>
  1726. <td valign="top"><b>Attribute</b></td>
  1727. <td valign="top"><b>Description</b></td>
  1728. <td align="center" valign="top"><b>Required</b></td>
  1729. </tr>
  1730. <tr>
  1731. <td valign="top">name</td>
  1732. <td valign="top">the name of the task</td>
  1733. <td valign="top" align="center">Yes</td>
  1734. </tr>
  1735. <tr>
  1736. <td valign="top">class</td>
  1737. <td valign="top">the full class name implementing the task</td>
  1738. <td valign="top" align="center">Yes</td>
  1739. </tr>
  1740. </table>
  1741. <h3>Examples</h3>
  1742. <pre> &lt;taskdef name=&quot;myjavadoc&quot; value=&quot;com.mydomain.JavadocTask&quot; /&gt;</pre>
  1743. <p>makes a task called <code>myjavadoc</code> available to Ant. The class <code>com.mydomain.JavadocTask</code>
  1744. implements the task.</p>
  1745. <hr>
  1746. <h2><a name="tstamp">Tstamp</a></h2>
  1747. <h3>Description</h3>
  1748. <p>Sets the DSTAMP, TSTAMP and TODAY properties in the current project. The
  1749. DSTAMP is in the &quot;yyyymmdd&quot; format, the TSTAMP is in the &quot;hhmm&quot;
  1750. format and TODAY is &quot;month day year&quot;.</p>
  1751. <p>These properties can be used in the buildfile, for instance, to create
  1752. timestamped filenames or used to replace placeholder tags inside documents to
  1753. indicate, for example, the release date. The best place for this task is in the <a
  1754. href="#inittarget">init target</a>.</p>
  1755. <h3>Parameters</h3>
  1756. <table border="1" cellpadding="2" cellspacing="0">
  1757. <tr>
  1758. <td valign="top"><b>Attribute</b></td>
  1759. <td valign="top"><b>Description</b></td>
  1760. <td align="center" valign="top"><b>Required</b></td>
  1761. </tr>
  1762. </table>
  1763. <h3>Examples</h3>
  1764. <pre> &lt;tstamp/&gt;</pre>
  1765. <hr>
  1766. <h2><a name="zip">Zip</a></h2>
  1767. <h3>Description</h3>
  1768. <p>Creates a zipfile.</p>
  1769. <p>The <i>basedir</i> attribute is the reference directory from where to zip.</p>
  1770. <p>It is possible to refine the set of files that are being zipped. This can be
  1771. done with the <i>includes</i>, <i>excludes</i> and <i>defaultexcludes</i>
  1772. attributes. With the <i>includes</i> attribute you specify the files you want to
  1773. have included by using patterns. The <i>exclude</i> attribute is used to specify
  1774. the files you want to have excluded. This is also done with patterns. And
  1775. finally with the <i>defaultexcludes</i> attribute, you can specify whether you
  1776. want to use default exclusions or not. See the section on <a
  1777. href="#directorybasedtasks">directory based tasks</a>, on how the
  1778. inclusion/exclusion of files works, and how to write patterns. The patterns are
  1779. relative to the <i>basedir</i> directory.</p>
  1780. <p>The <i>includes</i>, <i>excludes</i> and <i>defaultexcludes</i> attributes
  1781. replace the <i>items</i> and <i>ignore</i> attributes. The following explains
  1782. how the deprecated <i>items</i> and <i>ignore</i> attribute behave.</p>
  1783. <p>When &quot;*&quot; is used for <i>items</i>, all files in the basedir, and
  1784. its subdirectories, will be zipped. Otherwise all the files and directories
  1785. mentioned in the items list will zipped. When a directory is specified, then all
  1786. files within it are also zipped.</p>
  1787. <p>With the <i>ignore</i> attribute, you can specify files or directories to
  1788. ignore. These files will not be zipped. The items in the <i>ignore</i> attribute
  1789. override the items in the <i>items</i> attribute. The names specified in the <i>ignore</i>
  1790. attribute are just names, they do not contain any path information!</p>
  1791. <h3>Parameters</h3>
  1792. <table border="1" cellpadding="2" cellspacing="0">
  1793. <tr>
  1794. <td valign="top"><b>Attribute</b></td>
  1795. <td valign="top"><b>Description</b></td>
  1796. <td valign="top" align="center"><b>Required</b></td>
  1797. </tr>
  1798. <tr>
  1799. <td valign="top">zipfile</td>
  1800. <td valign="top">the zip-file to create.</td>
  1801. <td align="center" valign="top">Yes</td>
  1802. </tr>
  1803. <tr>
  1804. <td valign="top">basedir</td>
  1805. <td valign="top">the directory from which to zip the files.</td>
  1806. <td align="center" valign="top">Yes</td>
  1807. </tr>
  1808. <tr>
  1809. <td valign="top">items</td>
  1810. <td valign="top">a comma separated list of the files/directories to zip. All
  1811. files are included when omitted. (<b>deprecated</b>, use <i>includes</i>
  1812. instead).</td>
  1813. <td valign="top" align="center">No</td>
  1814. </tr>
  1815. <tr>
  1816. <td valign="top">ignore</td>
  1817. <td valign="top">comma separated list of filenames/directorynames to exclude
  1818. from the zip. No files (except default excludes) are excluded when
  1819. omitted. (<b>deprecated</b>, use <i>excludes</i> instead).</td>
  1820. <td valign="top" align="center">No</td>
  1821. </tr>
  1822. <tr>
  1823. <td valign="top">includes</td>
  1824. <td valign="top">comma separated list of patterns of files that must be
  1825. included. All files are included when omitted.</td>
  1826. <td valign="top" align="center">No</td>
  1827. </tr>
  1828. <tr>
  1829. <td valign="top">excludes</td>
  1830. <td valign="top">comma separated list of patterns of files that must be
  1831. excluded. No files (except default excludes) are excluded when omitted.</td>
  1832. <td valign="top" align="center">No</td>
  1833. </tr>
  1834. <tr>
  1835. <td valign="top">defaultexcludes</td>
  1836. <td valign="top">indicates whether default excludes should be used or not
  1837. (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when omitted.</td>
  1838. <td valign="top" align="center">No</td>
  1839. </tr>
  1840. </table>
  1841. <h3>Examples</h3>
  1842. <pre> &lt;zip zipfile=&quot;${dist}/manual.zip&quot;
  1843. basedir=&quot;htdocs/manual&quot;
  1844. /&gt;</pre>
  1845. <p>zips all files in the <code>htdocs/manual</code> directory in a file called <code>manual.zip</code>
  1846. in the <code>${dist}</code> directory.</p>
  1847. <pre> &lt;zip zipfile=&quot;${dist}/manual.zip&quot;
  1848. basedir=&quot;htdocs/manual&quot;
  1849. excludes=&quot;mydocs/**, **/todo.html&quot;
  1850. /&gt;</pre>
  1851. <p>zips all files in the <code>htdocs/manual</code> directory in a file called <code>manual.zip</code>
  1852. in the <code>${dist}</code> directory. Files in the directory <code>mydocs</code>,
  1853. or files with the name <code>todo.html</code> are excluded.</p>
  1854. <pre> &lt;zip zipfile=&quot;${dist}/manual.zip&quot;
  1855. basedir=&quot;htdocs/manual&quot;
  1856. includes=&quot;api/**/*.html&quot;
  1857. excludes=&quot;**/todo.html&quot;
  1858. /&gt;</pre>
  1859. <p>zips all files in the <code>htdocs/manual</code> directory in a file called <code>manual.zip</code>
  1860. in the <code>${dist}</code> directory. Only html files under the directory <code>api</code>
  1861. are zipped, and files with the name <code>todo.html</code> are excluded.</p>
  1862. <h3>Deprecated examples</h3>
  1863. <pre> &lt;zip zipfile=&quot;${dist}/manual.zip&quot;
  1864. basedir=&quot;htdocs/manual&quot;
  1865. items=&quot;*&quot;
  1866. /&gt;</pre>
  1867. <p>zips all files in the <code>htdocs/manual</code> directory in a file called <code>manual.zip</code>
  1868. in the <code>${dist}</code> directory.</p>
  1869. <pre> &lt;zip zipfile=&quot;${dist}/manual.zip&quot;
  1870. basedir=&quot;htdocs/manual&quot;
  1871. items=&quot;*&quot;
  1872. ignore=&quot;mydocs, todo.html&quot;
  1873. /&gt;</pre>
  1874. <p>zips all files in the <code>htdocs/manual</code> directory in a file called <code>manual.zip</code>
  1875. in the <code>${dist}</code> directory. Files/directories with the names <code>mydocs</code>
  1876. and <code>todo.html</code> are excluded.</p>
  1877. <hr>
  1878. <h2><a name="writingowntask">Writing your own task</a></h2>
  1879. <p>It is very easy to write your own task:</p>
  1880. <ol>
  1881. <li>Create a Java class that extends <code>org.apache.tools.ant.Task</code>.</li>
  1882. <li>For each attribute, write a setter method. The setter method must be a <code>public
  1883. void</code> method that takes one <code>String</code> as an argument. The
  1884. name of the method must begin with &quot;set&quot;, followed by the
  1885. attribute name, with the first character in uppercase, and the rest in
  1886. lowercase.</li>
  1887. <li>Write a <code>public void execute</code> method, with no arguments, that
  1888. throws a <code>BuildException</code>. This method implements the task
  1889. itself.</li>
  1890. </ol>
  1891. <p>It is important to know that Ant first calls the setters for the attributes
  1892. it encounters for a specific task in the buildfile, before it executes is.</p>
  1893. <p>Let's write our own task, that prints a message on the System.out stream. The
  1894. task has one attribute called &quot;message&quot;.</p>
  1895. <blockquote>
  1896. <pre>public class MyVeryOwnTask extends Task {
  1897. private String msg;
  1898. // The method executing the task
  1899. public void execute() throws BuildException {
  1900. System.out.println(message);
  1901. }
  1902. // The setter for the &quot;message&quot; attribute
  1903. public void setMessage(String msg) {
  1904. this.msg = msg;
  1905. }
  1906. }</pre>
  1907. </blockquote>
  1908. <p>It's really this simple;-)</p>
  1909. <p>Adding your task to the system is rather simple too:</p>
  1910. <ol>
  1911. <li>Make sure the class that implements your task is in the classpath when
  1912. starting Ant.</li>
  1913. <li>In the <i>init</i> target, add a <i>taskdef</i> task. This actually adds
  1914. your task to the system.</li>
  1915. <li>Use your task in the rest of the buildfile.</li>
  1916. </ol>
  1917. <h3>Example</h3>
  1918. <blockquote>
  1919. <pre>&lt;project name=&quot;TaskTest&quot; default=&quot;test&quot; basedir=&quot;.&quot;&gt;
  1920. &lt;target name=&quot;init&quot;&gt;
  1921. &lt;taskdef name=&quot;mytask&quot; class=&quot;com.mydomain.MyVeryOwnTask&quot;/&gt;
  1922. &lt;/target&gt;
  1923. &lt;target name=&quot;test&quot;&gt;
  1924. &lt;mytask myattr=&quot;wombat&quot; /&gt;
  1925. &lt;/target&gt;
  1926. &lt;/project&gt;
  1927. </pre>
  1928. </blockquote>
  1929. <p>Another way to add a task (more permanently), is to add the task name and
  1930. implementing class name to the <code>default.properties</code> file in the <code>org.apache.tools.ant.taskdefs</code>
  1931. package. Then you can use it as if it were a built in task.</p>
  1932. <hr>
  1933. <h2><a name="feedback">Feedback</a></h2>
  1934. <p>To provide feedback on this software, please subscribe to the Ant Development
  1935. Mail List <a href="mailto:(ant-dev-subscribe@jakarta.apache.org">(ant-dev-subscribe@jakarta.apache.org</a>)</p>
  1936. <hr>
  1937. <p align="center">Copyright 2000 Apache Software Foundation. All rights
  1938. Reserved.</p>
  1939. </body>
  1940. </html>