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 60 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
  5. <meta name="ProgId" content="FrontPage.Editor.Document">
  6. <title>Ant</title>
  7. </head>
  8. <body>
  9. <h1>Ant User Manual</h1>
  10. <p>by&nbsp;</p>
  11. <ul>
  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.2 - 2000/01/26</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="#tasks">Built in Tasks</a>
  26. <li><a href="#writingowntask">Writing your own task</a></li>
  27. <li><a href="#license">License</a></li>
  28. <li><a href="#feedback">Feedback</a></li>
  29. </ul>
  30. <hr>
  31. <h2><a name="introduction">Introduction</a></h2>
  32. <p>Ant is a Java based build tool. In theory it is kind of like make without
  33. makes wrinkles.</p>
  34. <h3>Why?</h3>
  35. <p>Why another build tool when there is already make, gnumake, nmake, jam, and
  36. others? Because all of those tools have limitations that its original author
  37. couldn't live with when developing software across multiple platforms. Make like
  38. tools are inherently shell based. They evaluate a set of dependencies and then
  39. execute commands not unlike what you would issue on a shell. This means that you
  40. can easily extend these tools by using or writing any program for the OS that
  41. you are working on. However, this also means that you limit yourself to the OS,
  42. or at least the OS type such as Unix, that you are working on.</p>
  43. <p>Makefiles are inherently evil as well. Anybody who has worked on them for any
  44. time has run into the dreaded tab problem. &quot;Is my command not executing
  45. because I have a space in front of my tab!!!&quot; said the original author of
  46. Ant way too many times. Tools like Jam took care of this to a great degree, but
  47. still use yet another format to use and remember.</p>
  48. <p>Ant is different. Instead a model where it is extended with shell based
  49. commands, it is extended using Java classes. Instead of writing shell commands,
  50. the configuration files are XML based calling out a target tree where various
  51. tasks get executed. Each task is run by an object which implements a particular
  52. Task interface.</p>
  53. <p>Granted, this removes some of the expressive power that is inherent by being
  54. able to construct a shell command such as `find . -name foo -exec rm {}` but it
  55. gives you the ability to be cross platform. To work anywhere and everywhere. And
  56. hey, if you really need to execute a shell command, Ant has an exec rule that
  57. allows different commands to be executed based on the OS that it is executing
  58. on.</p>
  59. <hr>
  60. <h2><a name="getting">Getting Ant</a></h2>
  61. <h3>Binary edition</h3>
  62. <p>The latest stable version of Ant can be downloaded from <a
  63. href="http://jakarta.apache.org/builds/tomcat/release/v3.0/ant.zip">http://jakarta.apache.org/builds/tomcat/release/v3.0/ant.zip</a>.
  64. If you like living on the edge, you can download the latest version from <a
  65. href="http://jakarta.apache.org/builds/tomcat/nightly/ant.zip">http://jakarta.apache.org/builds/tomcat/nightly/ant.zip</a>.</p>
  66. <h3>Source edition</h3>
  67. <p>If you prefer the source edition, you can download Ant from <a
  68. 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>
  69. (latest stable) or from <a
  70. href="http://jakarta.apache.org/from-cvs/jakarta-tools/">http://jakarta.apache.org/from-cvs/jakarta-ant/</a>
  71. (current). See the section <a href="#buildingant">Building Ant</a> on how to
  72. build Ant from the source code.</p>
  73. <hr>
  74. <h2><a name="buildingant">Building Ant</a></h2>
  75. <p>Go to the directory <code>jakarta-ant</code>.</p>
  76. <p>Make sure the JDK is in you path.</p>
  77. <p>Run <code>bootstrap.bat</code> (Windows) or <code>bootstrap.sh</code> (UNIX)
  78. to build a bootstrap version of Ant.</p>
  79. <p>When finished, use</p>
  80. <blockquote>
  81. <p><code>build.bat -Ddist.dir=&lt;directory to install Ant&gt; dist</code></p>
  82. </blockquote>
  83. <p>for Windows, and</p>
  84. <blockquote>
  85. <p><code>build.sh -Ddist.dir=&lt;directory to install Ant&gt; dist</code></p>
  86. </blockquote>
  87. <p>for UNIX, to create a binary distribution of Ant. This distribution can be
  88. found in the directory you specified.</p>
  89. <hr>
  90. <h2><a name="installing">Installing Ant</a></h2>
  91. <p>The binary distribution of Ant consists of three directories: <code>bin</code>,
  92. <code>docs</code> and <code>lib</code>. Only the <code>bin</code> and <code>lib</code>
  93. directory are crucial for running Ant. To run Ant, the following must be done:</p>
  94. <ul>
  95. <li>Add the <code>bin</code> directory to your path.</li>
  96. <li>Set the ANT_HOME environment variable. This should be set to the directory
  97. which contains the <code>bin</code> and <code>lib</code> directory.</li>
  98. <li>Set the JAVA_HOME environment variable. This should be set to the
  99. directory where the JDK is installed.</li>
  100. </ul>
  101. <h3>Windows</h3>
  102. <p>Assume Ant is installed in <code>c:\ant\</code>. The following sets up the
  103. environment:</p>
  104. <pre>set ANT_HOME=c:\ant
  105. set JAVA_HOME=c:\jdk1.2.2
  106. set PATH=%PATH%;%ANT_HOME%\bin</pre>
  107. <h3>Unix (bash)</h3>
  108. <p>Assume Ant is installed in <code>/usr/local/ant</code>. The following sets up
  109. the environment:</p>
  110. <pre>export ANT_HOME=/usr/local/ant
  111. export JAVA_HOME=/usr/local/jdk-1.2.2
  112. export PATH=${PATH}:${ANT_HOME}/bin</pre>
  113. <h3>Advanced</h3>
  114. <p>There are lots of variants that can be used to run Ant. What you need is at
  115. least the following:</p>
  116. <p>The classpath for Ant must contain <code>ant.jar</code> and <code>xml.jar</code>.</p>
  117. <p>When you need JDK functionality (like a <a href="#javac">javac</a> task, or a
  118. <a href="#rmic">rmic</a> task), then for JDK 1.1, the <code>classes.zip</code>
  119. file of the JDK must be added to the classpath; for JDK 1.2, <code>tools.jar</code>
  120. must be added.</p>
  121. <p>When you are executing platform specific applications (like the <a
  122. href="#exec">exec</a> task, or the <a href="#cvs">cvs</a> task), the property <code>ant.home</code>
  123. must be set to the directory containing a bin directory, which contains <code>antRun.bat</code>
  124. (Windows) or <code>antRun</code> (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. <pre>&lt;target name=&quot;A&quot;/&gt;
  227. &lt;target name=&quot;B&quot; depends=&quot;A&quot;/&gt;
  228. &lt;target name=&quot;C&quot; depends=&quot;B&quot;/&gt;
  229. &lt;target name=&quot;D&quot; depends=&quot;C,B,A&quot;/&gt;</pre>
  230. <p>Suppose we want to execute target D. From its <i>depends</i> attribute, you
  231. might think that first target C, then B and then A is executed. Wrong! C depends
  232. on B, and B depends on A, so first A is executed, then B, then C, and finally D.</p>
  233. <p>In situations without such dependencies, you can rely on the order of the
  234. targets in the <i>depends</i> attributes.</p>
  235. <p>A target gets executed only once. Even when more targets depend on it (see
  236. the previous example).</p>
  237. <p>A target has the following attributes:</p>
  238. <table border="1" cellpadding="2" cellspacing="0">
  239. <tr>
  240. <td valign="top"><b>Attribute</b></td>
  241. <td valign="top"><b>Description</b></td>
  242. <td align="center" valign="top"><b>Required</b></td>
  243. </tr>
  244. <tr>
  245. <td valign="top">name</td>
  246. <td valign="top">the name of the project.</td>
  247. <td align="center" valign="top">Yes</td>
  248. </tr>
  249. <tr>
  250. <td valign="top">depends</td>
  251. <td valign="top">a comma separated list of names of targets on which this
  252. target depends.</td>
  253. <td align="center" valign="top">No</td>
  254. </tr>
  255. </table>
  256. <h3>Tasks</h3>
  257. <p>A task is a piece of code that can be executed.</p>
  258. <p>A task can have multiple attributes (or arguments if you prefer). The value
  259. of an attribute might contain references to a property. These references will be
  260. resolved before the task is executed.</p>
  261. <p>Tasks have a common structure:</p>
  262. <blockquote>
  263. <pre>&lt;name attribute1=&quot;value1&quot; attribute2=&quot;value2&quot; ... /&gt;</pre>
  264. </blockquote>
  265. <p>where name is the name of the task, attribute-x the attribute name, and
  266. value-x the value of this attribute.</p>
  267. <p>There is a set of <a href="#tasks">built in tasks</a>, but it is also very
  268. easy to <a href="#writingowntask">write your own</a>.</p>
  269. <h3>Properties</h3>
  270. <p>A project can have a set of properties. These might be set in the buildfile
  271. by the <a href="#property">property task</a>, or might be set outside Ant. A
  272. property has a name and a value. Properties might be used in in the value of
  273. task attributes. This is done by placing the property name between
  274. &quot;${&quot; and &quot;}&quot; in the attribute value.</p>
  275. <p>If there is a property called &quot;builddir&quot; with the value
  276. &quot;build&quot;, then this could be used in an attribute like this: &quot;${builddir}/classes&quot;.
  277. This is resolved as &quot;build/classes&quot;.</p>
  278. <h3>Examples</h3>
  279. <blockquote>
  280. <pre>&lt;project name=&quot;foo&quot; default=&quot;dist&quot; basedir=&quot;.&quot;&gt;
  281. &lt;target name=&quot;init&quot;&gt;
  282. &lt;tstamp/&gt;
  283. &lt;property name=&quot;build&quot; value=&quot;build&quot; /&gt;
  284. &lt;property name=&quot;dist&quot; value=&quot;dist&quot; /&gt;
  285. &lt;/target&gt;
  286. &lt;target name=&quot;prepare&quot; depends=&quot;init&quot;&gt;
  287. &lt;mkdir dir=&quot;${build}&quot; /&gt;
  288. &lt;/target&gt;
  289. &lt;target name=&quot;compile&quot; depends=&quot;prepare&quot;&gt;
  290. &lt;javac srcdir=&quot;${src}&quot; destdir=&quot;${build}&quot; /&gt;
  291. &lt;/target&gt;
  292. &lt;target name=&quot;dist&quot; depends=&quot;compile&quot;&gt;
  293. &lt;mkdir dir=&quot;${dist}/lib&quot; /&gt;
  294. &lt;jar jarfile=&quot;${dist}/lib/foo${DSTAMP}.jar&quot;
  295. basedir=&quot;${build}&quot; items=&quot;com&quot;/&gt;
  296. &lt;/target&gt;
  297. &lt;target name=&quot;clean&quot; depends=&quot;init&quot;&gt;
  298. &lt;deltree dir=&quot;${build}&quot; /&gt;
  299. &lt;deltree dir=&quot;${dist}&quot; /&gt;
  300. &lt;/target&gt;
  301. &lt;/project&gt;
  302. </pre>
  303. </blockquote>
  304. <hr>
  305. <h2><a name="tasks">Built in tasks</a></h2>
  306. <ul>
  307. <li><a href="#ant">Ant</a></li>
  308. <li><a href="#chmod">Chmod</a></li>
  309. <li><a href="#copydir">Copydir</a></li>
  310. <li><a href="#copyfile">Copyfile</a></li>
  311. <li><a href="#cvs">Cvs</a></li>
  312. <li><a href="#delete">Delete</a></li>
  313. <li><a href="#deltree">Deltree</a></li>
  314. <li><a href="#echo">Echo</a></li>
  315. <li><a href="#exec">Exec</a></li>
  316. <li><a href="#expand">Expand</a></li>
  317. <li><a href="#get">Get</a></li>
  318. <li><a href="#gzip">GZip</a></li>
  319. <li><a href="#jar">Jar</a></li>
  320. <li><a href="#java">Java</a></li>
  321. <li><a href="#javac">Javac</a></li>
  322. <li><a href="#javadoc">Javadoc/Javadoc2</a></li>
  323. <li><a href="#keysubst">KeySubst</a></li>
  324. <li><a href="#mkdir">Mkdir</a></li>
  325. <li><a href="#property">Property</a></li>
  326. <li><a href="#replace">Replace</a></li>
  327. <li><a href="#rmic">Rmic</a></li>
  328. <li><a href="#taskdef">Taskdef</a></li>
  329. <li><a href="#tstamp">Tstamp</a></li>
  330. <li><a href="#zip">Zip</a></li>
  331. </ul>
  332. <hr>
  333. <h2><a name="ant">Ant</a></h2>
  334. <h3><b>Description:</b></h3>
  335. <p>Runs Ant on a supplied buildfile. This can be used to build subprojects.</p>
  336. <p>When the <i>antfile</i> attribute is omitted, the file &quot;build.xml&quot;
  337. in the supplied directory (<i>dir</i> attribute) is used.</p>
  338. <p>If no target attribute is supplied, the default target of the new project is
  339. used.</p>
  340. <p>The properties of the current project will be available in the new project.
  341. These properties will override the properties that are set in the new project.
  342. (See also the <a href="#property">properties task</a>).</p>
  343. <h3>Parameters:</h3>
  344. <table border="1" cellpadding="2" cellspacing="0">
  345. <tr>
  346. <td valign="top"><b>Attribute</b></td>
  347. <td valign="top"><b>Description</b></td>
  348. <td align="center" valign="top"><b>Required</b></td>
  349. </tr>
  350. <tr>
  351. <td valign="top">antfile</td>
  352. <td valign="top">the buildfile to use.</td>
  353. <td valign="top" align="center">No</td>
  354. </tr>
  355. <tr>
  356. <td valign="top">dir</td>
  357. <td valign="top">the directory to use as a basedir for the new Ant project.</td>
  358. <td valign="top" align="center">Yes</td>
  359. </tr>
  360. <tr>
  361. <td valign="top">target</td>
  362. <td valign="top">the target of the new Ant project that should be executed.</td>
  363. <td valign="top" align="center">No</td>
  364. </tr>
  365. </table>
  366. <h3>Examples</h3>
  367. <blockquote>
  368. <p><code>&lt;ant antfile=&quot;subproject/subbuild.xml&quot; dir=&quot;subproject&quot;
  369. target=&quot;compile&quot; /&gt;</code></p>
  370. <p><code>&lt;ant dir=&quot;subproject&quot; /&gt;</code></p>
  371. </blockquote>
  372. <hr>
  373. <h2><a name="chmod">Chmod</a></h2>
  374. <h3>Description</h3>
  375. <p>Changes the permissions of a file. Right now it has efect only under Unix.
  376. The permissions are also UNIX style, like the argument for the chmod command.</p>
  377. <h3>Parameters</h3>
  378. <table border="1" cellpadding="2" cellspacing="0">
  379. <tr>
  380. <td valign="top"><b>Attribute</b></td>
  381. <td valign="top"><b>Description</b></td>
  382. <td align="center" valign="top"><b>Required</b></td>
  383. </tr>
  384. <tr>
  385. <td valign="top">src</td>
  386. <td valign="top">the file of which the permissions must be changed.</td>
  387. <td valign="top" align="center">Yes</td>
  388. </tr>
  389. <tr>
  390. <td valign="top">perm</td>
  391. <td valign="top">the new permissions.</td>
  392. <td valign="top" align="center">Yes</td>
  393. </tr>
  394. </table>
  395. <h3>Examples</h3>
  396. <blockquote>
  397. <p><code>&lt;chmod src=&quot;${dist}/start.sh&quot; perm=&quot;ugo+rx&quot;
  398. /&gt;</code></p>
  399. </blockquote>
  400. <p>makes the &quot;start.sh&quot; file readable and executable for anyone on a
  401. UNIX system.</p>
  402. <hr>
  403. <h2><a name="copydir">Copydir</a></h2>
  404. <h3>Description</h3>
  405. <p>Copies a directory tree from the source to the destination.</p>
  406. <p>It is possible to exclude a set of files from the files that are being
  407. copied. This can be done with the <i>ignore</i> attribute. This attribute
  408. contains the names of the files/directories that must be excluded from the copy.
  409. The names specified in the <i>ignore</i> attribute are just names, they do not
  410. contain any path information!</p>
  411. <h3>Parameters</h3>
  412. <table border="1" cellpadding="2" cellspacing="0">
  413. <tr>
  414. <td valign="top"><b>Attribute</b></td>
  415. <td valign="top"><b>Description</b></td>
  416. <td align="center" valign="top"><b>Required</b></td>
  417. </tr>
  418. <tr>
  419. <td valign="top">src</td>
  420. <td valign="top">the directory to copy.</td>
  421. <td valign="top" align="center">Yes</td>
  422. </tr>
  423. <tr>
  424. <td valign="top">dest</td>
  425. <td valign="top">the directory to copy to.</td>
  426. <td valign="top" align="center">Yes</td>
  427. </tr>
  428. <tr>
  429. <td valign="top">ignore</td>
  430. <td valign="top">comma separated list of filenames/directorynames to ignore.</td>
  431. <td valign="top" align="center">No</td>
  432. </tr>
  433. </table>
  434. <h3>Examples</h3>
  435. <blockquote>
  436. <p><code>&lt;copydir src=&quot;${src}/resources&quot; dest=&quot;${dist}&quot;
  437. /&gt;</code></p>
  438. </blockquote>
  439. <p>copies the directory <code>${src}/resources</code> to <code>${dist}</code>.</p>
  440. <blockquote>
  441. <p><code>&lt;copydir src=&quot;${src}/resources&quot; dest=&quot;${dist}&quot;
  442. ignore=&quot;old, Test.java&quot; /&gt;</code></p>
  443. </blockquote>
  444. <p>copies the directory <code>${src}/resources</code> to <code>${dist}</code>.
  445. All files/directories with the names <code>old</code> and <code>Test.java</code>
  446. are excluded from the copy. When <code>old</code> or <code>Test.java</code> is
  447. the name of a directory, then that whole directory is excluded from the copy.</p>
  448. <hr>
  449. <h2><a name="copyfile">Copyfile</a></h2>
  450. <h3>Description</h3>
  451. <p>Copies a file from the source to the destination. The file is only copied if
  452. the source file is newer than the destination file, or when the destination file
  453. does not exist.</p>
  454. <h3>Parameters</h3>
  455. <table border="1" cellpadding="2" cellspacing="0">
  456. <tr>
  457. <td valign="top"><b>Attribute</b></td>
  458. <td valign="top"><b>Description</b></td>
  459. <td align="center" valign="top"><b>Required</b></td>
  460. </tr>
  461. <tr>
  462. <td valign="top">src</td>
  463. <td valign="top">the filename of the file to copy.</td>
  464. <td valign="top" align="center">Yes</td>
  465. </tr>
  466. <tr>
  467. <td valign="top">dest</td>
  468. <td valign="top">the filename of the file where to copy to.</td>
  469. <td valign="top" align="center">Yes</td>
  470. </tr>
  471. </table>
  472. <h3>Examples</h3>
  473. <blockquote>
  474. <p><code>&lt;copyfile src=&quot;test.java&quot; dest=&quot;subdir/test.java&quot;
  475. /&gt;</code></p>
  476. <p><code>&lt;copyfile src=&quot;${src}/index.html&quot; dest=&quot;${dist}/help/index.html&quot;
  477. /&gt;</code></p>
  478. </blockquote>
  479. <hr>
  480. <h2><a name="cvs">Cvs</a></h2>
  481. <h3>Description</h3>
  482. <p>Checks out a package/module from a <a href="http://www.cyclic.com/">CVS</a>
  483. repository.</p>
  484. <p>When doing automated builds, the <a href="#get">get task</a> should be
  485. preferred, because of speed.</p>
  486. <h3>Parameters</h3>
  487. <table border="1" cellpadding="2" cellspacing="0">
  488. <tr>
  489. <td valign="top"><b>Attribute</b></td>
  490. <td valign="top"><b>Description</b></td>
  491. <td align="center" valign="top"><b>Required</b></td>
  492. </tr>
  493. <tr>
  494. <td valign="top">cvsRoot</td>
  495. <td valign="top">the CVSROOT variable.</td>
  496. <td align="center" valign="top">Yes</td>
  497. </tr>
  498. <tr>
  499. <td valign="top">dest</td>
  500. <td valign="top">the directory where the checked out files should be placed.</td>
  501. <td align="center" valign="top">Yes</td>
  502. </tr>
  503. <tr>
  504. <td valign="top">package</td>
  505. <td valign="top">the package/module to check out.</td>
  506. <td align="center" valign="top">Yes</td>
  507. </tr>
  508. <tr>
  509. <td valign="top">tag</td>
  510. <td valign="top">the tag of the package/module to check out.</td>
  511. <td align="center" valign="top">No</td>
  512. </tr>
  513. </table>
  514. <h3>Examples</h3>
  515. <blockquote>
  516. <p><code>&lt;cvs cvsRoot=&quot;:pserver:anoncvs@jakarta.apache.org:/home/cvspublic&quot;
  517. package=&quot;jakarta-tools&quot; dest=&quot;${ws.dir}&quot; /&gt;</code></p>
  518. </blockquote>
  519. <p>This checks out the package/module &quot;jakarta-tools&quot; from the CVS
  520. repository pointed to by the cvsRoot attribute, and stores the files in &quot;${ws.dir}&quot;.</p>
  521. <hr>
  522. <h2><a name="delete">Delete</a></h2>
  523. <h3>Description</h3>
  524. <p>Deletes a single file.</p>
  525. <h3>Parameters</h3>
  526. <table border="1" cellpadding="2" cellspacing="0">
  527. <tr>
  528. <td valign="top"><b>Attribute</b></td>
  529. <td valign="top"><b>Description</b></td>
  530. <td align="center" valign="top"><b>Required</b></td>
  531. </tr>
  532. <tr>
  533. <td valign="top">file</td>
  534. <td valign="top">the file to delete.</td>
  535. <td valign="top" align="center">Yes</td>
  536. </tr>
  537. </table>
  538. <h3>Examples</h3>
  539. <blockquote>
  540. <p><code>&lt;delete file=&quot;/lib/ant.jar&quot; /&gt;</code></p>
  541. <p><code>&lt;delete file=&quot;${ant}&quot; /&gt;</code></p>
  542. </blockquote>
  543. <hr>
  544. <h2><a name="deltree">Deltree</a></h2>
  545. <h3>Description</h3>
  546. <p>Deletes a directory with all its files and subdirectories.</p>
  547. <h3>Parameters</h3>
  548. <table border="1" cellpadding="2" cellspacing="0">
  549. <tr>
  550. <td valign="top"><b>Attribute</b></td>
  551. <td valign="top"><b>Description</b></td>
  552. <td align="center" valign="top"><b>Required</b></td>
  553. </tr>
  554. <tr>
  555. <td valign="top">dir</td>
  556. <td valign="top">the directory to delete.</td>
  557. <td valign="top" align="center">Yes</td>
  558. </tr>
  559. </table>
  560. <h3>Examples</h3>
  561. <blockquote>
  562. <p><code>&lt;deltree dir=&quot;dist&quot; /&gt;</code></p>
  563. <p><code>&lt;deltree dir=&quot;${dist}&quot; /&gt;</code></p>
  564. </blockquote>
  565. <hr>
  566. <h2><a name="echo">Echo</a></h2>
  567. <h3>Description</h3>
  568. <p>Echoes a message to System.out.</p>
  569. <h3>Parameters</h3>
  570. <table border="1" cellpadding="2" cellspacing="0">
  571. <tr>
  572. <td valign="top"><b>Attribute</b></td>
  573. <td valign="top"><b>Description</b></td>
  574. <td align="center" valign="top"><b>Required</b></td>
  575. </tr>
  576. <tr>
  577. <td valign="top">message</td>
  578. <td valign="top">the message to echo.</td>
  579. <td valign="top" align="center">Yes</td>
  580. </tr>
  581. </table>
  582. <h3>Examples</h3>
  583. <blockquote>
  584. <p><code>&lt;echo message=&quot;Hello world&quot; /&gt;</code></p>
  585. </blockquote>
  586. <hr>
  587. <h2><a name="exec">Exec</a></h2>
  588. <h3>Description</h3>
  589. <p>Executes a system command. When the <i>os</i> attribute is specified, then
  590. the command is only executed when Ant is run on one of the specified operating
  591. systems.</p>
  592. <h3>Parameters</h3>
  593. <table border="1" cellpadding="2" cellspacing="0">
  594. <tr>
  595. <td valign="top"><b>Attribute</b></td>
  596. <td valign="top"><b>Description</b></td>
  597. <td align="center" valign="top"><b>Required</b></td>
  598. </tr>
  599. <tr>
  600. <td valign="top">command</td>
  601. <td valign="top">the command to execute.</td>
  602. <td align="center" valign="top">Yes</td>
  603. </tr>
  604. <tr>
  605. <td valign="top">dir</td>
  606. <td valign="top">the directory in which the command should be executed.</td>
  607. <td align="center" valign="top">Yes</td>
  608. </tr>
  609. <tr>
  610. <td valign="top">os</td>
  611. <td valign="top">list of Operating Systems on which the command may be
  612. executed.</td>
  613. <td align="center" valign="top">No</td>
  614. </tr>
  615. <tr>
  616. <td valign="top">output</td>
  617. <td valign="top">the file to which the output of the command should be
  618. redirected.</td>
  619. <td align="center" valign="top">Yes</td>
  620. </tr>
  621. </table>
  622. <h3>Examples</h3>
  623. <blockquote>
  624. <p><code>&lt;exec dir=&quot;${src}&quot; command=&quot;dir&quot; os=&quot;windows&quot;
  625. output=&quot;dir.txt&quot; /&gt;</code></p>
  626. </blockquote>
  627. <hr>
  628. <h2><a name="expand">Expand</a></h2>
  629. <h3>Description</h3>
  630. <p>Unzips a zipfile.</p>
  631. <h3>Parameters</h3>
  632. <table border="1" cellpadding="2" cellspacing="0">
  633. <tr>
  634. <td valign="top"><b>Attribute</b></td>
  635. <td valign="top"><b>Description</b></td>
  636. <td align="center" valign="top"><b>Required</b></td>
  637. </tr>
  638. <tr>
  639. <td valign="top">src</td>
  640. <td valign="top">zipfile to expand.</td>
  641. <td align="center" valign="top">Yes</td>
  642. </tr>
  643. <tr>
  644. <td valign="top">dest</td>
  645. <td valign="top">directory where to store the expanded files.</td>
  646. <td align="center" valign="top">Yes</td>
  647. </tr>
  648. </table>
  649. <h3>Examples</h3>
  650. <blockquote>
  651. <p><code>&lt;expand src=&quot;${tomcat_src}/tools-src.zip&quot; dest=&quot;${tools.home}&quot;
  652. /&gt;</code></p>
  653. </blockquote>
  654. <hr>
  655. <h2><a name="get">Get</a></h2>
  656. <h3>Description</h3>
  657. <p>Gets a file from an URL. When the verbose option is &quot;on&quot;, this task
  658. displays a '.' for every 100 Kb retrieved.</p>
  659. <p>This task should be preferred above the <a href="#cvs">CVS task</a> when
  660. doing automated builds. CVS is significant slower than loading a compressed
  661. archive with http/ftp.</p>
  662. <h3>Parameters</h3>
  663. <table border="1" cellpadding="2" cellspacing="0">
  664. <tr>
  665. <td valign="top"><b>Attribute</b></td>
  666. <td valign="top"><b>Description</b></td>
  667. <td align="center" valign="top"><b>Required</b></td>
  668. </tr>
  669. <tr>
  670. <td valign="top">src</td>
  671. <td valign="top">the URL from which to retrieve a file.</td>
  672. <td align="center" valign="top">Yes</td>
  673. </tr>
  674. <tr>
  675. <td valign="top">dest</td>
  676. <td valign="top">the file where to store the retrieved file.</td>
  677. <td align="center" valign="top">Yes</td>
  678. </tr>
  679. <tr>
  680. <td valign="top">verbose</td>
  681. <td valign="top">show verbose information (&quot;on&quot;/&quot;off&quot;).</td>
  682. <td align="center" valign="top">No</td>
  683. </tr>
  684. </table>
  685. <h3>Examples</h3>
  686. <blockquote>
  687. <p><code>&lt;get src=&quot;http://jakarta.apache.org/&quot; dest=&quot;help/index.html&quot;
  688. /&gt;</code></p>
  689. </blockquote>
  690. <hr>
  691. <h2><a name="gzip">GZip</a></h2>
  692. <h3>Description</h3>
  693. <p>GZips a file.</p>
  694. <h3>Parameters</h3>
  695. <table border="1" cellpadding="2" cellspacing="0">
  696. <tr>
  697. <td valign="top"><b>Attribute</b></td>
  698. <td valign="top"><b>Description</b></td>
  699. <td align="center" valign="top"><b>Required</b></td>
  700. </tr>
  701. <tr>
  702. <td valign="top">src</td>
  703. <td valign="top">the file to gzip.</td>
  704. <td align="center" valign="top">Yes</td>
  705. </tr>
  706. <tr>
  707. <td valign="top">zipfile</td>
  708. <td valign="top">the destination file.</td>
  709. <td align="center" valign="top">Yes</td>
  710. </tr>
  711. </table>
  712. <h3>Examples</h3>
  713. <blockquote>
  714. <p><code>&lt;gzip src=&quot;test.tar&quot; zipfile=&quot;test.tar.gz&quot; /&gt;</code></p>
  715. </blockquote>
  716. <hr>
  717. <h2><a name="jar">Jar</a></h2>
  718. <h3>Description</h3>
  719. <p>Jars a set of files.</p>
  720. <p>The <i>basedir</i> attribute is the reference directory from where to jar.</p>
  721. <p>When &quot;*&quot; is used for items, all files in the basedir, and its
  722. subdirectories, will be jarred. Otherwise all the files and directories
  723. mentioned in the items list will jarred. When a directory is specified, then all
  724. files within it are also jarred.</p>
  725. <p>With the <i>ignore</i> attribute, you can specify files or directories to
  726. ignore. These files will not be jarred. The items in the <i>ignore</i> attribute
  727. override the items in the <i>items</i> attribute. The names specified in the <i>ignore</i>
  728. attribute are just names, they do not contain any path information!</p>
  729. <h3>Parameters</h3>
  730. <table border="1" cellpadding="2" cellspacing="0">
  731. <tr>
  732. <td valign="top"><b>Attribute</b></td>
  733. <td valign="top"><b>Description</b></td>
  734. <td align="center" valign="top"><b>Required</b></td>
  735. </tr>
  736. <tr>
  737. <td valign="top">jarfile</td>
  738. <td valign="top">the jar-file to create.</td>
  739. <td valign="top" align="center">Yes</td>
  740. </tr>
  741. <tr>
  742. <td valign="top">basedir</td>
  743. <td valign="top">the directory from which to jar the files.</td>
  744. <td valign="top" align="center">Yes</td>
  745. </tr>
  746. <tr>
  747. <td valign="top">items</td>
  748. <td valign="top">a comma separated list of the files/directories to jar.</td>
  749. <td valign="top" align="center">Yes</td>
  750. </tr>
  751. <tr>
  752. <td valign="top">ignore</td>
  753. <td valign="top">a comma separated list of the filenames/directorynames to
  754. exclude from the jar.</td>
  755. <td valign="top" align="center">No</td>
  756. </tr>
  757. <tr>
  758. <td valign="top">manifest</td>
  759. <td valign="top">the manifest file to use.</td>
  760. <td valign="top" align="center">No</td>
  761. </tr>
  762. </table>
  763. <h3>Examples</h3>
  764. <blockquote>
  765. <p><code>&lt;jar jarfile=&quot;${dist}/lib/app.jar&quot; basedir=&quot;${build}/classes&quot;
  766. items=&quot;*&quot; /&gt;</code></p>
  767. </blockquote>
  768. <p>jars all files in the <code>${build}/classes</code> directory in a file
  769. called <code>app.jar</code> in the <code>${dist}/lib</code> directory.</p>
  770. <blockquote>
  771. <p><code>&lt;jar jarfile=&quot;${dist}/lib/app.jar&quot; basedir=&quot;${build}/classes&quot;
  772. items=&quot;*&quot; ignore=&quot;Test.class&quot; /&gt;</code></p>
  773. </blockquote>
  774. <p>jars all files in the <code>${build}/classes</code> directory in a file
  775. called <code>app.jar</code> in the <code>${dist}/lib</code> directory.
  776. Files/directories with the name <code>Test.class</code> are excluded.</p>
  777. <hr>
  778. <h2><a name="java">Java</a></h2>
  779. <h3>Description</h3>
  780. <p>Executes a Java class within the running (Ant) VM or forks another VM if
  781. specified.</p>
  782. <p>Be careful that the executed class doesn't call System.exit(), because it
  783. will terminate the VM and thus Ant. In case this happens, it's highly suggested
  784. that you set the fork attribute so that System.exit() stops the other VM and not
  785. the one that is currently running Ant.</p>
  786. <h3>Parameters</h3>
  787. <table border="1" cellpadding="2" cellspacing="0">
  788. <tr>
  789. <td valign="top"><b>Attribute</b></td>
  790. <td valign="top"><b>Description</b></td>
  791. <td align="center" valign="top"><b>Required</b></td>
  792. </tr>
  793. <tr>
  794. <td valign="top">class</td>
  795. <td valign="top">the Java class to execute.</td>
  796. <td align="center" valign="top">Yes</td>
  797. </tr>
  798. <tr>
  799. <td valign="top">args</td>
  800. <td valign="top">the arguments for the class that is executed.</td>
  801. <td align="center" valign="top">No</td>
  802. </tr>
  803. <tr>
  804. <td valign="top">fork</td>
  805. <td valign="top">if enabled triggers the class execution in another VM
  806. (disabled by default)</td>
  807. <td align="center" valign="top">No</td>
  808. </tr>
  809. <tr>
  810. <td valign="top">jvmargs</td>
  811. <td valign="top">the arguments to pass to the forked VM (ignored if fork is
  812. disabled)</td>
  813. <td align="center" valign="top">No</td>
  814. </tr>
  815. </table>
  816. <h3>Examples</h3>
  817. <blockquote>
  818. <p><code>&lt;java class=&quot;test.Main&quot; /&gt;</code></p>
  819. <p><code>&lt;java class=&quot;test.Main&quot; args=&quot;-h&quot; /&gt;</code></p>
  820. <p><code>&lt;java class=&quot;test.Main&quot; args=&quot;-h&quot;
  821. fork=&quot;yes&quot; jvmargs=&quot;-Xrunhprof:cpu=samples,file=log.txt,depth=3&quot;
  822. /&gt;</code></p>
  823. </blockquote>
  824. <hr>
  825. <h2><a name="javac">Javac</a></h2>
  826. <h3>Description</h3>
  827. <p>Compiles a source tree within the running (Ant) VM.</p>
  828. <p>The source and destination directory will be recursively scanned for Java
  829. source files to compile. Only Java files that have no corresponding class file
  830. or where the class file is older than the java file will be compiled.</p>
  831. <p>Files in the source tree, that are no java files, are copied to the
  832. destination directory, allowing support files to be located properly in the
  833. classpath.</p>
  834. <p>The directory structure of the source tree should follow the package
  835. hierarchy.</p>
  836. <p>It is possible to use different compilers. This can be selected with the
  837. &quot;build.compiler&quot; property. There are three choices:</p>
  838. <ul>
  839. <li>classic (the standard compiler of JDK 1.1/1.2)</li>
  840. <li>modern (the new compiler of JDK 1.3)</li>
  841. <li>jikes (the <a
  842. href="http://oss.software.ibm.com/developerworks/opensource/jikes/project">Jikes</a>
  843. compiler)</li>
  844. </ul>
  845. <p>For JDK 1.1/1.2 is classic the default. For JDK 1.3 is modern the default.</p>
  846. <h3>Parameters</h3>
  847. <table border="1" cellpadding="2" cellspacing="0">
  848. <tr>
  849. <td valign="top"><b>Attribute</b></td>
  850. <td valign="top"><b>Description</b></td>
  851. <td align="center" valign="top"><b>Required</b></td>
  852. </tr>
  853. <tr>
  854. <td valign="top">srcdir</td>
  855. <td valign="top">location of the java files.</td>
  856. <td align="center" valign="top">Yes</td>
  857. </tr>
  858. <tr>
  859. <td valign="top">destdir</td>
  860. <td valign="top">location where to store the class files.</td>
  861. <td align="center" valign="top">Yes</td>
  862. </tr>
  863. <tr>
  864. <td valign="top">classpath</td>
  865. <td valign="top">the classpath to use.</td>
  866. <td align="center" valign="top">No</td>
  867. </tr>
  868. <tr>
  869. <td valign="top">bootclasspath</td>
  870. <td valign="top">location of bootstrap class files.</td>
  871. <td align="center" valign="top">No</td>
  872. </tr>
  873. <tr>
  874. <td valign="top">extdirs</td>
  875. <td valign="top">location of installed extensions.</td>
  876. <td align="center" valign="top">No</td>
  877. </tr>
  878. <tr>
  879. <td valign="top">debug</td>
  880. <td valign="top">indicates whether there should be compiled with debug
  881. information (&quot;on&quot;).</td>
  882. <td align="center" valign="top">No</td>
  883. </tr>
  884. <tr>
  885. <td valign="top">optimize</td>
  886. <td valign="top">indicates whether there should be compiled with
  887. optimization (&quot;on&quot;).</td>
  888. <td align="center" valign="top">No</td>
  889. </tr>
  890. <tr>
  891. <td valign="top">deprecation</td>
  892. <td valign="top">indicates whether there should be compiled with deprecation
  893. information (&quot;on&quot;).</td>
  894. <td align="center" valign="top">No</td>
  895. </tr>
  896. </table>
  897. <h3>Examples</h3>
  898. <blockquote>
  899. <p><code>&lt;javac srcdir=&quot;${src}&quot; destdir=&quot;${build}&quot; -classpath=&quot;xyz.jar&quot;
  900. -debug=&quot;on&quot; /&gt;</code></p>
  901. </blockquote>
  902. <hr>
  903. <h2><a name="javadoc">Javadoc/Javadoc2</a></h2>
  904. <h3>Description</h3>
  905. <p>Generates code documentation using the javadoc tool.</p>
  906. <p>The source directory will be recursively scanned for Java
  907. source files to but only those matching the inclusion rules will be passed to
  908. the javadoc tool. This allows wildcards to be used to choose between package
  909. names, reducing verbosity and management costs over time. This task, however,
  910. has no notion of &quot;changed&quot; files, unlike the <a href="#javac">javac</a>
  911. task, but it's not used so frequently.</p>
  912. <p>This task works seamlessly between different javadoc versions (1.1 and 1.2),
  913. with the obvious restriction that the 1.2 attributes will be ignored if run in a
  914. 1.1 VM.</p>
  915. <p>NOTE: since javadoc calls System.exit(), we cannot run javadoc inside the
  916. same VM without breaking functionality. For this reason, this task always forks
  917. the VM. But this is not a performance penalty since javadoc is normally a heavy
  918. application and must be called just once.</p>
  919. <p>DEPRECATION: the javadoc2 task simply points to the javadoc task and it's
  920. there for back compatibility reasons. Since this task will be removed in future
  921. versions, you are strongly encouraged to use <a href="#javadoc">javadoc</a>
  922. instead.</p>
  923. <h3>Parameters</h3>
  924. <table border="1" cellpadding="2" cellspacing="0">
  925. <tr>
  926. <td valign="top"><b>Attribute</b></td>
  927. <td valign="top"><b>Description</b></td>
  928. <td align="center" valign="top"><b>Availability</b></td>
  929. <td align="center" valign="top"><b>Required</b></td>
  930. </tr>
  931. <tr>
  932. <td valign="top">sourcepath</td>
  933. <td valign="top">Specify where to find source files</td>
  934. <td align="center" valign="top">all</td>
  935. <td align="center" valign="top">yes</td>
  936. </tr>
  937. <tr>
  938. <td valign="top">destdir</td>
  939. <td valign="top">Destination directory for output files</td>
  940. <td align="center" valign="top">all</td>
  941. <td align="center" valign="top">yes</td>
  942. </tr>
  943. <tr>
  944. <td valign="top">sourcefiles</td>
  945. <td valign="top">Space separated list of source files</td>
  946. <td align="center" valign="top">all</td>
  947. <td align="center" valign="middle" rowspan="2">at least one of the two</td>
  948. </tr>
  949. <tr>
  950. <td valign="top">packagenames</td>
  951. <td valign="top">Space separated list of package files (with terminating
  952. wildcard)</td>
  953. <td align="center" valign="top">all</td>
  954. </tr>
  955. <tr>
  956. <td valign="top">Classpath</td>
  957. <td valign="top">Specify where to find user class files</td>
  958. <td align="center" valign="top">all</td>
  959. <td align="center" valign="top">no</td>
  960. </tr>
  961. <tr>
  962. <td valign="top">Bootclasspath</td>
  963. <td valign="top">Override location of class files loaded by the bootstrap class loader</td>
  964. <td align="center" valign="top">1.2</td>
  965. <td align="center" valign="top">no</td>
  966. </tr>
  967. <tr>
  968. <td valign="top">Extdirs</td>
  969. <td valign="top">Override location of installed extensions</td>
  970. <td align="center" valign="top">1.2</td>
  971. <td align="center" valign="top">no</td>
  972. </tr>
  973. <tr>
  974. <td valign="top">Overview</td>
  975. <td valign="top">Read overview documentation from HTML file</td>
  976. <td align="center" valign="top">1.2</td>
  977. <td align="center" valign="top">no</td>
  978. </tr>
  979. <tr>
  980. <td valign="top">Public</td>
  981. <td valign="top">Show only public classes and members</td>
  982. <td align="center" valign="top">all</td>
  983. <td align="center" valign="top">no</td>
  984. </tr>
  985. <tr>
  986. <td valign="top">Protected</td>
  987. <td valign="top">Show protected/public classes and members (default)</td>
  988. <td align="center" valign="top">all</td>
  989. <td align="center" valign="top">no</td>
  990. </tr>
  991. <tr>
  992. <td valign="top">Package</td>
  993. <td valign="top">Show package/protected/public classes and members</td>
  994. <td align="center" valign="top">all</td>
  995. <td align="center" valign="top">no</td>
  996. </tr>
  997. <tr>
  998. <td valign="top">Private</td>
  999. <td valign="top">Show all classes and members</td>
  1000. <td align="center" valign="top">all</td>
  1001. <td align="center" valign="top">no</td>
  1002. </tr>
  1003. <tr>
  1004. <td valign="top">Old</td>
  1005. <td valign="top">Generate output using JDK 1.1 emulating doclet</td>
  1006. <td align="center" valign="top">1.2</td>
  1007. <td align="center" valign="top">no</td>
  1008. </tr>
  1009. <tr>
  1010. <td valign="top">Verbose</td>
  1011. <td valign="top">Output messages about what Javadoc is doing</td>
  1012. <td align="center" valign="top">1.2</td>
  1013. <td align="center" valign="top">no</td>
  1014. </tr>
  1015. <tr>
  1016. <td valign="top">Locale</td>
  1017. <td valign="top">Locale to be used, e.g. en_US or en_US_WIN</td>
  1018. <td align="center" valign="top">1.2</td>
  1019. <td align="center" valign="top">no</td>
  1020. </tr>
  1021. <tr>
  1022. <td valign="top">Encoding</td>
  1023. <td valign="top">Source file encoding name</td>
  1024. <td align="center" valign="top">all</td>
  1025. <td align="center" valign="top">no</td>
  1026. </tr>
  1027. <tr>
  1028. <td valign="top">Version</td>
  1029. <td valign="top">Include @version paragraphs</td>
  1030. <td align="center" valign="top">all</td>
  1031. <td align="center" valign="top">no</td>
  1032. </tr>
  1033. <tr>
  1034. <td valign="top">Use</td>
  1035. <td valign="top">Create class and package usage pages</td>
  1036. <td align="center" valign="top">1.2</td>
  1037. <td align="center" valign="top">no</td>
  1038. </tr>
  1039. <tr>
  1040. <td valign="top">Author</td>
  1041. <td valign="top">Include @author paragraphs</td>
  1042. <td align="center" valign="top">all</td>
  1043. <td align="center" valign="top">no</td>
  1044. </tr>
  1045. <tr>
  1046. <td valign="top">Splitindex</td>
  1047. <td valign="top"> Split index into one file per letter</td>
  1048. <td align="center" valign="top">1.2</td>
  1049. <td align="center" valign="top">no</td>
  1050. </tr>
  1051. <tr>
  1052. <td valign="top">Windowtitle</td>
  1053. <td valign="top">Browser window title for the documenation (text)</td>
  1054. <td align="center" valign="top">1.2</td>
  1055. <td align="center" valign="top">no</td>
  1056. </tr>
  1057. <tr>
  1058. <td valign="top">Doctitle</td>
  1059. <td valign="top"> Include title for the package index(first) page
  1060. (html-code)</td>
  1061. <td align="center" valign="top">1.2</td>
  1062. <td align="center" valign="top">no</td>
  1063. </tr>
  1064. <tr>
  1065. <td valign="top">Header</td>
  1066. <td valign="top"> Include header text for each page (html-code)</td>
  1067. <td align="center" valign="top">1.2</td>
  1068. <td align="center" valign="top">no</td>
  1069. </tr>
  1070. <tr>
  1071. <td valign="top">Footer</td>
  1072. <td valign="top"> Include footer text for each page (html-code)</td>
  1073. <td align="center" valign="top">1.2</td>
  1074. <td align="center" valign="top">no</td>
  1075. </tr>
  1076. <tr>
  1077. <td valign="top">bottom</td>
  1078. <td valign="top"> Include bottom text for each page (html-code)</td>
  1079. <td align="center" valign="top">1.2</td>
  1080. <td align="center" valign="top">no</td>
  1081. </tr>
  1082. <tr>
  1083. <td valign="top">link</td>
  1084. <td valign="top"> Create links to javadoc output at the given
  1085. URL</td>
  1086. <td align="center" valign="top">1.2</td>
  1087. <td align="center" valign="top">no</td>
  1088. </tr>
  1089. <tr>
  1090. <td valign="top">linkoffline</td>
  1091. <td valign="top"> Link to docs at &lt;url&gt; using package list at &lt;url2></td>
  1092. <td align="center" valign="top">1.2</td>
  1093. <td align="center" valign="top">no</td>
  1094. </tr>
  1095. <tr>
  1096. <td valign="top">group</td>
  1097. <td valign="top"> Group specified packages together in overview page</td>
  1098. <td align="center" valign="top">1.2</td>
  1099. <td align="center" valign="top">no</td>
  1100. </tr>
  1101. <tr>
  1102. <td valign="top">nodeprecated</td>
  1103. <td valign="top"> Do not include @deprecated information</td>
  1104. <td align="center" valign="top">all</td>
  1105. <td align="center" valign="top">no</td>
  1106. </tr>
  1107. <tr>
  1108. <td valign="top">nodeprecatedlist</td>
  1109. <td valign="top"> Do not generate deprecated list</td>
  1110. <td align="center" valign="top">1.2</td>
  1111. <td align="center" valign="top">no</td>
  1112. </tr>
  1113. <tr>
  1114. <td valign="top">notree</td>
  1115. <td valign="top"> Do not generate class hierarchy</td>
  1116. <td align="center" valign="top">all</td>
  1117. <td align="center" valign="top">no</td>
  1118. </tr>
  1119. <tr>
  1120. <td valign="top">noindex</td>
  1121. <td valign="top"> Do not generate index</td>
  1122. <td align="center" valign="top">all</td>
  1123. <td align="center" valign="top">no</td>
  1124. </tr>
  1125. <tr>
  1126. <td valign="top">nohelp</td>
  1127. <td valign="top"> Do not generate help link</td>
  1128. <td align="center" valign="top">1.2</td>
  1129. <td align="center" valign="top">no</td>
  1130. </tr>
  1131. <tr>
  1132. <td valign="top">nonavbar</td>
  1133. <td valign="top"> Do not generate navigation bar</td>
  1134. <td align="center" valign="top">1.2</td>
  1135. <td align="center" valign="top">no</td>
  1136. </tr>
  1137. <tr>
  1138. <td valign="top">serialwarn</td>
  1139. <td valign="top"> Generate warning about @serial tag</td>
  1140. <td align="center" valign="top">1.2</td>
  1141. <td align="center" valign="top">no</td>
  1142. </tr>
  1143. <tr>
  1144. <td valign="top">helpfile</td>
  1145. <td valign="top">Specifies the HTML help file to use</td>
  1146. <td align="center" valign="top">1.2</td>
  1147. <td align="center" valign="top">no</td>
  1148. </tr>
  1149. <tr>
  1150. <td valign="top">stylesheetfile</td>
  1151. <td valign="top">Specifies the CSS stylesheet to use</td>
  1152. <td align="center" valign="top">1.2</td>
  1153. <td align="center" valign="top">no</td>
  1154. </tr>
  1155. <tr>
  1156. <td valign="top">charset</td>
  1157. <td valign="top"> Charset for cross-platform viewing of generated documentation</td>
  1158. <td align="center" valign="top">1.2</td>
  1159. <td align="center" valign="top">no</td>
  1160. </tr>
  1161. <tr>
  1162. <td valign="top">docencoding</td>
  1163. <td valign="top">Output file encoding name</td>
  1164. <td align="center" valign="top">1.1</td>
  1165. <td align="center" valign="top">no</td>
  1166. </tr>
  1167. </table>
  1168. <h3>Examples</h3>
  1169. <blockquote>
  1170. <pre>&lt;javadoc packagenames=&quot;com.dummy.test.*&quot;
  1171. sourcepath=&quot;src&quot;
  1172. destdir=&quot;docs/api&quot;
  1173. author=&quot;true&quot;
  1174. version=&quot;true&quot;
  1175. use=&quot;true&quot;
  1176. windowtitle=&quot;Test API&quot;
  1177. doctitle=&quot;&lt;h1&gt;Test&lt;/h1&gt;&quot;
  1178. bottom=&quot;&lt;i&gt;Copyright &amp;#169; 2000 Dummy Corp. All Rights Reserved.&lt;/i&gt;&quot;
  1179. /&gt;</pre>
  1180. </blockquote>
  1181. <hr>
  1182. <h2><a name="keysubst">KeySubst</a></h2>
  1183. <h3>Description</h3>
  1184. <p>Performs keyword substitution in the source file, and writes the result to
  1185. the destination file.</p>
  1186. <p>Keys in the source file are of the form ${keyname}. The <i>keys</i> attribute
  1187. contains key/value pairs. When a key is found in the <i>keys</i> attribute, then
  1188. &quot;${keyname}&quot; is replaced by the corresponding value.</p>
  1189. <p>The <i>keys</i> attribute is of the form
  1190. &quot;name1=value1*name2=value2*name3=value3&quot;. The '*' is called the
  1191. separator, which might we changed with the <i>sep</i> attribute.</p>
  1192. <p>Note: the source file and destination file may not be the same.</p>
  1193. <h3>Parameters</h3>
  1194. <table border="1" cellpadding="2" cellspacing="0">
  1195. <tr>
  1196. <td valign="top"><b>Attribute</b></td>
  1197. <td valign="top"><b>Description</b></td>
  1198. <td align="center" valign="top"><b>Required</b></td>
  1199. </tr>
  1200. <tr>
  1201. <td valign="top">src</td>
  1202. <td valign="top">the source file.</td>
  1203. <td align="center" valign="top">Yes</td>
  1204. </tr>
  1205. <tr>
  1206. <td valign="top">dest</td>
  1207. <td valign="top">the destination file.</td>
  1208. <td align="center" valign="top">Yes</td>
  1209. </tr>
  1210. <tr>
  1211. <td valign="top">sep</td>
  1212. <td valign="top">the separator for the name/value pairs.</td>
  1213. <td align="center" valign="top">No</td>
  1214. </tr>
  1215. <tr>
  1216. <td valign="top">keys</td>
  1217. <td valign="top">name/value pairs for replacement.</td>
  1218. <td align="center" valign="top">Yes</td>
  1219. </tr>
  1220. </table>
  1221. <h3>Examples</h3>
  1222. <blockquote>
  1223. <p><code>&lt;keysubst src=&quot;abc.txt&quot; dest=&quot;def.txt&quot;
  1224. keys=&quot;VERSION=1.0.3*DATE=2000-01-10&quot; /&gt;</code></p>
  1225. </blockquote>
  1226. <hr>
  1227. <h2><a name="mkdir">Mkdir</a></h2>
  1228. <h3>Description</h3>
  1229. <p>Creates a directory. Also non-existent parent directories are created, when
  1230. necessary.</p>
  1231. <h3>Parameters</h3>
  1232. <table border="1" cellpadding="2" cellspacing="0">
  1233. <tr>
  1234. <td valign="top"><b>Attribute</b></td>
  1235. <td valign="top"><b>Description</b></td>
  1236. <td align="center" valign="top"><b>Required</b></td>
  1237. </tr>
  1238. <tr>
  1239. <td valign="top">dir</td>
  1240. <td valign="top">the directory to create.</td>
  1241. <td align="center" valign="top">Yes</td>
  1242. </tr>
  1243. </table>
  1244. <h3>Examples</h3>
  1245. <blockquote>
  1246. <p><code>&lt;mkdir dir=&quot;${dist}&quot; /&gt;</code></p>
  1247. <p><code>&lt;mkdir dir=&quot;${dist}/lib&quot; /&gt;</code></p>
  1248. </blockquote>
  1249. <hr>
  1250. <h2><a name="property">Property</a></h2>
  1251. <h3>Description</h3>
  1252. <p>Sets a property (by name and value), or set of properties (from file or
  1253. resource) in the project.</p>
  1254. <p>When a property was set by the user, or was a property in a parent project
  1255. (that started this project with the <a href="#ant">ant task</a>), then this
  1256. property cannot be set, and will be ignored. This means that properties set
  1257. outside the current project always override the properties of the current
  1258. project.</p>
  1259. <p>There are three ways to set properties:</p>
  1260. <ul>
  1261. <li>By supplying both the <i>name</i> and <i>value</i> attribute.</li>
  1262. <li>By setting the <i>file</i> attribute with the filename of the property
  1263. file to load. This property file has the format as defined by the file used
  1264. in the class java.util.Properties.</li>
  1265. <li>By setting the <i>resource</i> attribute with the resource name of the
  1266. property file to load. This property file has the format as defined by the
  1267. file used in the class java.util.Properties.</li>
  1268. </ul>
  1269. <p>Although combinations of the three ways are possible, only one should be used
  1270. at a time. Problems might occur with the order in which properties are set, for
  1271. instance.</p>
  1272. <p>The value part of the properties being set, might contain references to other
  1273. properties. These references are resolved at the time these properties are set.
  1274. This also holds for properties loaded from a property file.</p>
  1275. <h3>Parameters</h3>
  1276. <table border="1" cellpadding="2" cellspacing="0">
  1277. <tr>
  1278. <td valign="top"><b>Attribute</b></td>
  1279. <td valign="top"><b>Description</b></td>
  1280. <td align="center" valign="top"><b>Required</b></td>
  1281. </tr>
  1282. <tr>
  1283. <td valign="top">name</td>
  1284. <td valign="top">the name of the property to set.</td>
  1285. <td valign="top" align="center">No</td>
  1286. </tr>
  1287. <tr>
  1288. <td valign="top">value</td>
  1289. <td valign="top">the value of the property.</td>
  1290. <td valign="top" align="center">No</td>
  1291. </tr>
  1292. <tr>
  1293. <td valign="top">resource</td>
  1294. <td valign="top">the resource name of the property file.</td>
  1295. <td valign="top" align="center">No</td>
  1296. </tr>
  1297. <tr>
  1298. <td valign="top">file</td>
  1299. <td valign="top">the filename of the property file .</td>
  1300. <td valign="top" align="center">No</td>
  1301. </tr>
  1302. </table>
  1303. <h3>Examples</h3>
  1304. <blockquote>
  1305. <p><code>&lt;property name=&quot;foo.dist&quot; value=&quot;dist&quot;/&gt;</code></p>
  1306. <p><code>&lt;property file=&quot;foo.properties&quot; /&gt;</code></p>
  1307. <p><code>&lt;property resource=&quot;foo.properties&quot; /&gt;</code></p>
  1308. </blockquote>
  1309. <hr>
  1310. <h2><a name="replace">Replace</a></h2>
  1311. <h3>Description</h3>
  1312. <p>Replaces the occurrence of a given string with another string in a file. When
  1313. the <i>value</i> attribute is omitted, it defaults to &quot;&quot;.</p>
  1314. <h3>Parameters</h3>
  1315. <table border="1" cellpadding="2" cellspacing="0">
  1316. <tr>
  1317. <td valign="top"><b>Attribute</b></td>
  1318. <td valign="top"><b>Description</b></td>
  1319. <td align="center" valign="top"><b>Required</b></td>
  1320. </tr>
  1321. <tr>
  1322. <td valign="top">file</td>
  1323. <td valign="top">file for which the token should be replaced</td>
  1324. <td valign="top" align="center">Yes</td>
  1325. </tr>
  1326. <tr>
  1327. <td valign="top">token</td>
  1328. <td valign="top">the token which must be replaced</td>
  1329. <td valign="top" align="center">Yes</td>
  1330. </tr>
  1331. <tr>
  1332. <td valign="top">value</td>
  1333. <td valign="top">the new value for the token</td>
  1334. <td valign="top" align="center">No</td>
  1335. </tr>
  1336. </table>
  1337. <h3>Examples</h3>
  1338. <blockquote>
  1339. <p><code>&lt;replace file=&quot;${src}/index.html&quot; token=&quot;@@@&quot;
  1340. value=&quot;wombat&quot; /&gt;</code></p>
  1341. </blockquote>
  1342. <hr>
  1343. <h2><a name="rmic">Rmic</a></h2>
  1344. <h3>Description</h3>
  1345. <p>Runs the rmic compiler for a certain class.</p>
  1346. <h3>Parameters</h3>
  1347. <table border="1" cellpadding="2" cellspacing="0">
  1348. <tr>
  1349. <td valign="top"><b>Attribute</b></td>
  1350. <td valign="top"><b>Description</b></td>
  1351. <td align="center" valign="top"><b>Required</b></td>
  1352. </tr>
  1353. <tr>
  1354. <td valign="top">base</td>
  1355. <td valign="top">the location to store the compiled files.</td>
  1356. <td valign="top" align="center">Yes</td>
  1357. </tr>
  1358. <tr>
  1359. <td valign="top">class</td>
  1360. <td valign="top">the class for which to run <code>rmic</code>.</td>
  1361. <td valign="top" align="center">Yes</td>
  1362. </tr>
  1363. </table>
  1364. <h3>Examples</h3>
  1365. <blockquote>
  1366. <p><code>&lt;rmic class=&quot;com.xyz.FooBar&quot;
  1367. base=&quot;${build}/classes&quot; /&gt;</code></p>
  1368. </blockquote>
  1369. <hr>
  1370. <h2><a name="taskdef">Taskdef</a></h2>
  1371. <h3>Description</h3>
  1372. <p>Adds a task definition to the current project, such that this new task can be
  1373. used in the current project. Two attributes are needed, the name that identifies
  1374. this task uniquely, and the full name of the class (including the packages) that
  1375. implements this task.</p>
  1376. <p>Taskdef should be used to add your own tasks to the system. See also &quot;<a
  1377. href="#writingowntask">Writing your own task</a>&quot;.</p>
  1378. <h3>Parameters</h3>
  1379. <table border="1" cellpadding="2" cellspacing="0">
  1380. <tr>
  1381. <td valign="top"><b>Attribute</b></td>
  1382. <td valign="top"><b>Description</b></td>
  1383. <td align="center" valign="top"><b>Required</b></td>
  1384. </tr>
  1385. <tr>
  1386. <td valign="top">name</td>
  1387. <td valign="top">the name of the task</td>
  1388. <td valign="top" align="center">Yes</td>
  1389. </tr>
  1390. <tr>
  1391. <td valign="top">class</td>
  1392. <td valign="top">the full class name implementing the task</td>
  1393. <td valign="top" align="center">Yes</td>
  1394. </tr>
  1395. </table>
  1396. <h3>Examples</h3>
  1397. <blockquote>
  1398. <p><code>&lt;taskdef name=&quot;myjavadoc&quot; value=&quot;com.mydomain.JavadocTask&quot;
  1399. /&gt;</code></p>
  1400. </blockquote>
  1401. <hr>
  1402. <h2><a name="tstamp">Tstamp</a></h2>
  1403. <h3>Description</h3>
  1404. <p>Sets the DSTAMP, TSTAMP and TODAY properties in the current project. The DSTAMP is
  1405. in the &quot;yyyymmdd&quot; format, the TSTAMP is in the &quot;hhmm&quot; format
  1406. and TODAY is &quot;month day year&quot;.</p>
  1407. <p>These properties can be used in the buildfile, for instance, to create
  1408. timestamped filenames or used to replace placeholder tags inside documents to
  1409. indicate, for example, the release date. The best place for this task is in the <a
  1410. href="#inittarget">init target</a>.</p>
  1411. <h3>Parameters</h3>
  1412. <table border="1" cellpadding="2" cellspacing="0">
  1413. <tr>
  1414. <td valign="top"><b>Attribute</b></td>
  1415. <td valign="top"><b>Description</b></td>
  1416. <td align="center" valign="top"><b>Required</b></td>
  1417. </tr>
  1418. </table>
  1419. <h3>Examples</h3>
  1420. <blockquote>
  1421. <p><code>&lt;tstamp/&gt;</code></p>
  1422. </blockquote>
  1423. <hr>
  1424. <h2><a name="zip">Zip</a></h2>
  1425. <h3>Description</h3>
  1426. <p>Creates a zipfile.</p>
  1427. <p>The <i>basedir</i> attribute is the reference directory from where to zip.</p>
  1428. <p>When &quot;*&quot; is used for items, all files in the basedir, and its
  1429. subdirectories, will be zipped. Otherwise all the files and directories
  1430. mentioned in the items list will zipped. When a directory is specified, then all
  1431. files within it are also zipped.</p>
  1432. <p>With the <i>ignore</i> attribute, you can specify names of files or
  1433. directories to ignore. These files will not be zipped. The items in the <i>ignore</i>
  1434. attribute override the items in the <i>items</i> attribute. The names specified
  1435. in the <i>ignore</i> attribute are just names, they do not contain any path
  1436. information!</p>
  1437. <h3>Parameters</h3>
  1438. <table border="1" cellpadding="2" cellspacing="0">
  1439. <tr>
  1440. <td valign="top"><b>Attribute</b></td>
  1441. <td valign="top"><b>Description</b></td>
  1442. <td valign="top" align="center"><b>Required</b></td>
  1443. </tr>
  1444. <tr>
  1445. <td valign="top">zipfile</td>
  1446. <td valign="top">the zip-file to create.</td>
  1447. <td align="center" valign="top">Yes</td>
  1448. </tr>
  1449. <tr>
  1450. <td valign="top">basedir</td>
  1451. <td valign="top">the directory from which to zip the files.</td>
  1452. <td align="center" valign="top">Yes</td>
  1453. </tr>
  1454. <tr>
  1455. <td valign="top">items</td>
  1456. <td valign="top">a comma separated list of the files/directories to zip.</td>
  1457. <td align="center" valign="top">Yes</td>
  1458. </tr>
  1459. <tr>
  1460. <td valign="top">ignore</td>
  1461. <td valign="top">a comma separated list of the filenames/directorynames to
  1462. exclude from the zip.</td>
  1463. <td align="center" valign="top">No</td>
  1464. </tr>
  1465. </table>
  1466. <h3>Examples</h3>
  1467. <blockquote>
  1468. <p><code>&lt;zip zipfile=&quot;${dist}/manual.zip&quot; basedir=&quot;htdocs/manual&quot;
  1469. items=&quot;*&quot; /&gt;</code></p>
  1470. </blockquote>
  1471. <p>zips all files in the <code>htdocs/manual</code> directory in a file called <code>manual.zip</code>
  1472. in the <code>${dist}</code> directory.</p>
  1473. <blockquote>
  1474. <p><code>&lt;zip zipfile=&quot;${dist}/manual.zip&quot; basedir=&quot;htdocs/manual&quot;
  1475. items=&quot;*&quot; ignore=&quot;mydocs, todo.html&quot;/&gt;</code></p>
  1476. </blockquote>
  1477. <p>zips all files in the <code>htdocs/manual</code> directory in a file called <code>manual.zip</code>
  1478. in the <code>${dist}</code> directory. Files/directories with the names <code>mydocs</code>
  1479. and <code>todo.html</code> are excluded.</p>
  1480. <hr>
  1481. <h2><a name="writingowntask">Writing your own task</a></h2>
  1482. <p>It is very easy to write your own task:</p>
  1483. <ol>
  1484. <li>Create a Java class that extends <code>org.apache.tools.ant.Task</code>.</li>
  1485. <li>For each attribute, write a setter method. The setter method must be a <code>public
  1486. void</code> method that takes one <code>String</code> as an argument. The
  1487. name of the method must begin with &quot;set&quot;, followed by the
  1488. attribute name, with the first character in uppercase, and the rest in
  1489. lowercase.</li>
  1490. <li>Write a <code>public void execute</code> method, with no arguments, that
  1491. throws a <code>BuildException</code>. This method implements the task
  1492. itself.</li>
  1493. </ol>
  1494. <p>It is important to know that Ant first calls the setters for the attributes
  1495. it encounters for a specific task in the buildfile, before it executes is.</p>
  1496. <p>Let's write our own task, that prints a message on the System.out stream. The
  1497. task has one attribute called &quot;message&quot;.</p>
  1498. <blockquote>
  1499. <pre>public class MyVeryOwnTask extends Task {
  1500. private String msg;
  1501. // The method executing the task
  1502. public void execute() throws BuildException {
  1503. System.out.println(message);
  1504. }
  1505. // The setter for the &quot;message&quot; attribute
  1506. public void setMessage(String msg) {
  1507. this.msg = msg;
  1508. }
  1509. }</pre>
  1510. </blockquote>
  1511. <p>It's really this simple;-)</p>
  1512. <p>Adding your task to the system is rather simple too:</p>
  1513. <ol>
  1514. <li>Make sure the class that implements your task is in the classpath when
  1515. starting Ant.</li>
  1516. <li>In the <i>init</i> target, add a <i>taskdef</i> task. This actually adds
  1517. your task to the system.</li>
  1518. <li>Use your task in the rest of the buildfile.</li>
  1519. </ol>
  1520. <h3>Example</h3>
  1521. <blockquote>
  1522. <pre>&lt;project name=&quot;TaskTest&quot; default=&quot;test&quot; basedir=&quot;.&quot;&gt;
  1523. &lt;target name=&quot;init&quot;&gt;
  1524. &lt;taskdef name=&quot;mytask&quot; class=&quot;com.mydomain.MyVeryOwnTask&quot;/&gt;
  1525. &lt;/target&gt;
  1526. &lt;target name=&quot;test&quot;&gt;
  1527. &lt;mytask myattr=&quot;wombat&quot; /&gt;
  1528. &lt;/target&gt;
  1529. &lt;/project&gt;
  1530. </pre>
  1531. </blockquote>
  1532. <p>Another way to add a task (more permanently), is to add the task name and
  1533. implementing class name to the <code>default.properties</code> file in the <code>org.apache.tools.ant.taskdefs</code>
  1534. package. Then you can use it as if it were a built in task.</p>
  1535. <hr>
  1536. <h2><a name="feedback">Feedback</a></h2>
  1537. <p>To provide feedback on this software, please subscribe to the Ant Development
  1538. Mail List <a href="mailto:(ant-dev-subscribe@jakarta.apache.org">(ant-dev-subscribe@jakarta.apache.org</a>)</p>
  1539. <hr>
  1540. <p align="center">Copyright &copy; 2000 Apache Software Foundation. All
  1541. rights Reserved.</p>
  1542. </body>
  1543. </html>