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 146 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644
  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>Jacques Bergeron (<a href="mailto:jacques.bergeron@dogico.com">jacques.bergeron@dogico.com</a>)</li>
  12. <li>Stefan Bodewig (<a href="mailto:stefan.bodewig@megabit.net">stefan.bodewig@megabit.net</a>)</li>
  13. <li>Patrick Chanezon (<a href="mailto:chanezon@netscape.com">chanezon@netscape.com</a>)</li>
  14. <li>James Duncan Davison (<a href="mailto:duncan@x180.com">duncan@x180.com</a>)</li>
  15. <li>Tom Dimock (<a href="mailto:tad1@cornell.edu">tad1@cornell.edu</a>)</li>
  16. <li>Bill Kelly (<a href="mailto:bill.kelly@softwired-inc.com">bill.kelly@softwired-inc.com</a>)</li>
  17. <li>Arnout J. Kuiper (<a href="mailto:ajkuiper@wxs.nl">ajkuiper@wxs.nl</a>)</li>
  18. <li>Conor MacNeill (<a href="mailto:conor@cortexebusiness.com.au">conor@cortexebusiness.com.au</a>)</li>
  19. <li>Stefano Mazzocchi (<a href="mailto:stefano@apache.org">stefano@apache.org</a>)</li>
  20. <li>Sam Ruby (<a href="mailto:rubys@us.ibm.com">rubys@us.ibm.com</a>)</li>
  21. </ul>
  22. <p>Version 1.0.8.2 - 2000/07/12</p>
  23. <hr>
  24. <h2>Table of Contents</h2>
  25. <ul>
  26. <li><a href="#introduction">Introduction</a></li>
  27. <li><a href="#getting">Getting Ant</a></li>
  28. <li><a href="#sysrequirements">System Requirements</a></li>
  29. <li><a href="#buildingant">Building Ant</a></li>
  30. <li><a href="#installing">Installing Ant</a></li>
  31. <li><a href="#running">Running Ant</a></li>
  32. <li><a href="#buildfile">Writing a simple buildfile</a>
  33. <li><a href="#directorybasedtasks">Directory based tasks</a></li>
  34. <li><a href="#tasks">Built in Tasks</a>
  35. <li><a href="#optionaltasks">Optional Tasks</a>
  36. <li><a href="#buildevents">Build Events</a>
  37. <li><a href="#writingowntask">Writing your own task</a></li>
  38. <li><a href="#faq">FAQ, DTD, external resources</a>
  39. <li><a href="#license">License</a></li>
  40. <li><a href="#feedback">Feedback</a></li>
  41. </ul>
  42. <hr>
  43. <h2><a name="introduction">Introduction</a></h2>
  44. <p>Ant is a Java based build tool. In theory it is kind of like make without
  45. make's wrinkles.</p>
  46. <h3>Why?</h3>
  47. <p>Why another build tool when there is already make, gnumake, nmake, jam, and
  48. others? Because all of those tools have limitations that its original author
  49. couldn't live with when developing software across multiple platforms. Make like
  50. tools are inherently shell based. They evaluate a set of dependencies and then
  51. execute commands not unlike what you would issue on a shell. This means that you
  52. can easily extend these tools by using or writing any program for the OS that
  53. you are working on. However, this also means that you limit yourself to the OS,
  54. or at least the OS type such as Unix, that you are working on.</p>
  55. <p>Makefiles are inherently evil as well. Anybody who has worked on them for any
  56. time has run into the dreaded tab problem. &quot;Is my command not executing
  57. because I have a space in front of my tab!!!&quot; said the original author of
  58. Ant way too many times. Tools like Jam took care of this to a great degree, but
  59. still use yet another format to use and remember.</p>
  60. <p>Ant is different. Instead a model where it is extended with shell based
  61. commands, it is extended using Java classes. Instead of writing shell commands,
  62. the configuration files are XML based calling out a target tree where various
  63. tasks get executed. Each task is run by an object which implements a particular
  64. Task interface.</p>
  65. <p>Granted, this removes some of the expressive power that is inherent by being
  66. able to construct a shell command such as `find . -name foo -exec rm {}` but it
  67. gives you the ability to be cross platform. To work anywhere and everywhere. And
  68. hey, if you really need to execute a shell command, Ant has an exec rule that
  69. allows different commands to be executed based on the OS that it is executing
  70. on.</p>
  71. <hr>
  72. <h2><a name="getting">Getting Ant</a></h2>
  73. <h3>Binary edition</h3>
  74. <p>The latest stable version of Ant can be downloaded from <a
  75. href="http://jakarta.apache.org/builds/tomcat/release/v3.0/ant.zip">http://jakarta.apache.org/builds/tomcat/release/v3.0/ant.zip</a>.
  76. If you like living on the edge, you can download the latest version from <a
  77. href="http://jakarta.apache.org/builds/tomcat/nightly/ant.zip">http://jakarta.apache.org/builds/tomcat/nightly/ant.zip</a>.</p>
  78. <h3>Source edition</h3>
  79. <p>If you prefer the source edition, you can download Ant from <a
  80. 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>
  81. (latest stable) or from <a
  82. href="http://jakarta.apache.org/from-cvs/jakarta-tools/">http://jakarta.apache.org/from-cvs/jakarta-ant/</a>
  83. (current). See the section <a href="#buildingant">Building Ant</a> on how to
  84. build Ant from the source code.</p>
  85. <hr>
  86. <h2><a name="sysrequirements">System Requirements</a></h2>
  87. <p>
  88. To build and use ant you must have a JAXP compilant XML parser installed and available on your classpath.
  89. <p>
  90. If you do not have a JAXP compliant XML parse installed, you may use the reference implementation
  91. available from Sun. It is available from <a href="http://java.sun.com/xml">http://java.sun.com/xml</a>.
  92. Once installed make sure the "jaxp.jar" and "parser.jar" files are in your classpath.
  93. <p>
  94. You will also need the JDK installed on your system, version 1.1 or later.
  95. <hr>
  96. <h2><a name="buildingant">Building Ant</a></h2>
  97. <p>Go to the directory <code>jakarta-ant</code>.</p>
  98. <p>Make sure the JDK is in you path.</p>
  99. <p>Run <code>bootstrap.bat</code> (Windows) or <code>bootstrap.sh</code> (UNIX)
  100. to build a bootstrap version of Ant.</p>
  101. <p>When finished, use</p>
  102. <blockquote>
  103. <p><code>build.bat -Dant.dist.dir=&lt;directory to install Ant&gt; dist</code></p>
  104. </blockquote>
  105. <p>for Windows, and</p>
  106. <blockquote>
  107. <p><code>build.sh -Dant.dist.dir=&lt;directory to install Ant&gt; dist</code></p>
  108. </blockquote>
  109. <p>for UNIX, to create a binary distribution of Ant. This distribution can be
  110. found in the directory you specified.</p>
  111. <hr>
  112. <h2><a name="installing">Installing Ant</a></h2>
  113. <p>The binary distribution of Ant consists of three directories: <code>bin</code>,
  114. <code>docs</code> and <code>lib</code>. Only the <code>bin</code> and <code>lib</code>
  115. directory are crucial for running Ant. To run Ant, the following must be done:</p>
  116. <ul>
  117. <li>Add the <code>bin</code> directory to your path.</li>
  118. <li>Set the ANT_HOME environment variable. This should be set to the directory
  119. which contains the <code>bin</code> and <code>lib</code> directory.</li>
  120. <li>Set the JAVA_HOME environment variable. This should be set to the
  121. directory where the JDK is installed.</li>
  122. </ul>
  123. <h3>Windows</h3>
  124. <p>Assume Ant is installed in <code>c:\ant\</code>. The following sets up the
  125. environment:</p>
  126. <pre>set ANT_HOME=c:\ant
  127. set JAVA_HOME=c:\jdk1.2.2
  128. set PATH=%PATH%;%ANT_HOME%\bin</pre>
  129. <h3>Unix (bash)</h3>
  130. <p>Assume Ant is installed in <code>/usr/local/ant</code>. The following sets up
  131. the environment:</p>
  132. <pre>export ANT_HOME=/usr/local/ant
  133. export JAVA_HOME=/usr/local/jdk-1.2.2
  134. export PATH=${PATH}:${ANT_HOME}/bin</pre>
  135. <h3>Advanced</h3>
  136. <p>There are lots of variants that can be used to run Ant. What you need is at
  137. least the following:</p>
  138. <p>The classpath for Ant must contain <code>ant.jar</code> and any jars/classes
  139. needed for your chosen JAXP compliant XML parser.</p>
  140. <p>When you need JDK functionality (like a <a href="#javac">javac</a> task, or a
  141. <a href="#rmic">rmic</a> task), then for JDK 1.1, the <code>classes.zip</code>
  142. file of the JDK must be added to the classpath; for JDK 1.2, <code>tools.jar</code>
  143. must be added. The scripts supplied with ant, in the bin directory, will add
  144. <code>tools.jar</code> automatically if the JAVA_HOME environment variable is set.</p>
  145. <p>When you are executing platform specific applications (like the <a
  146. href="#exec">exec</a> task, or the <a href="#cvs">cvs</a> task), the property <code>ant.home</code>
  147. 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>
  148. <hr>
  149. <h2><a name="running">Running Ant</a></h2>
  150. <p>Running Ant is simple, when you installed it as described in the previous
  151. section. Just type <code>ant</code>.</p>
  152. <p>When nothing is specified, Ant looks for a <code>build.xml</code> file in the
  153. current directory. When found, it uses that file as a buildfile. To make Ant use
  154. another buildfile, use the commandline option <i>-buildfile &lt;file&gt;</i>,
  155. where <i>&lt;file&gt;</i> is the buildfile you want to use.</p>
  156. <p>You can also set properties which override properties specified in the
  157. buildfile (see the <a href="#property">property task</a>).
  158. This can be done with the <i>-D&lt;property&gt;=&lt;value&gt;</i>
  159. option, where <i>&lt;property&gt;</i> is the name of the property and <i>&lt;value&gt;</i>
  160. the value.</p>
  161. <p>To more options are <i>-quiet</i> which instructs Ant to print less
  162. information on the console when running. The option <i>-verbose</i> on the other
  163. hand makes Ant print more information on the console.</p>
  164. <p>It is also possible to specify the target that should be executed. Default
  165. the target that is mentioned in the <i>default</i> attribute of the project is
  166. used. This can be overridden by adding the target name to the end of the
  167. commandline.</p>
  168. <p>Commandline option summary:</p>
  169. <pre>ant [options] [target]
  170. Options:
  171. -help print this message
  172. -version print the version information and exit
  173. -quiet be extra quiet
  174. -verbose be extra verbose
  175. -logfile &lt;file&gt; use given file for log
  176. -listener &lt;classname&gt; add an instance of class as a project listener
  177. -buildfile &lt;file&gt; use given buildfile
  178. -D&lt;property&gt;=&lt;value&gt; use value for given property</pre>
  179. <h3>Examples</h3>
  180. <blockquote>
  181. <pre>ant</pre>
  182. </blockquote>
  183. <p>runs Ant using the <code>build.xml</code> file in the current directory, on
  184. the default target.</p>
  185. <blockquote>
  186. <pre>ant -buildfile test.xml</pre>
  187. </blockquote>
  188. <p>runs Ant using the <code>test.xml</code> file in the current directory, on
  189. the default target.</p>
  190. <blockquote>
  191. <pre>ant -buildfile test.xml dist</pre>
  192. </blockquote>
  193. <p>runs Ant using the <code>test.xml</code> file in the current directory, on a
  194. target called <code>dist</code>.</p>
  195. <blockquote>
  196. <pre>ant -buildfile test.xml -Dbuild=build/classes dist</pre>
  197. </blockquote>
  198. <p>runs Ant using the <code>test.xml</code> file in the current directory, on a
  199. target called <code>dist</code>. It also sets the <i>build</i> property to the
  200. value <i>build/classes</i>.</p>
  201. <h3>Running Ant by hand</h3>
  202. <p>When you have installed Ant in the do-it-yourself way, Ant can be started
  203. with:</p>
  204. <blockquote>
  205. <pre>java -Dant.home=c:\ant org.apache.tools.ant.Main [options] [target]</pre>
  206. </blockquote>
  207. <p>These instructions actually do exactly the same as the <code>ant</code>
  208. command. The options and target are the same as when running Ant with the <code>ant</code>
  209. command. This example assumes you have set up your classpath to include
  210. <ul>
  211. <li>ant.jar
  212. <li>jars/classes for your XML parser
  213. <li>the JDK's tools.jar
  214. </ul>
  215. <hr>
  216. <h2><a name="buildfile">Writing a simple buildfile</a></h2>
  217. <p>The buildfile is written in XML. Each buildfile contains one project.</p>
  218. <h3>Projects</h3>
  219. <p>A project has three attributes:</p>
  220. <table border="1" cellpadding="2" cellspacing="0">
  221. <tr>
  222. <td valign="top"><b>Attribute</b></td>
  223. <td valign="top"><b>Description</b></td>
  224. <td align="center" valign="top"><b>Required</b></td>
  225. </tr>
  226. <tr>
  227. <td valign="top">name</td>
  228. <td valign="top">the name of the project.</td>
  229. <td align="center" valign="top">Yes</td>
  230. </tr>
  231. <tr>
  232. <td valign="top">default</td>
  233. <td valign="top">the default target to use when no target is supplied.</td>
  234. <td align="center" valign="top">Yes</td>
  235. </tr>
  236. <tr>
  237. <td valign="top">basedir</td>
  238. <td valign="top">the base directory from which all path calculations are
  239. done. This attribute might be overridden by setting the &quot;basedir&quot;
  240. property on forehand. When this is done, it might be ommitted in the
  241. project tag.</td>
  242. <td align="center" valign="top">Yes</td>
  243. </tr>
  244. </table>
  245. <p>Each project defines one or more targets. A target is a set of tasks you want
  246. to be executed. When starting Ant, you can select which target you want to have
  247. executed. When no target is given, the project's default is used.</p>
  248. <h3>Targets</h3>
  249. <p>A target can depend on other targets. You might have a target for compiling,
  250. for instance, and a target for creating a distributable. You can only build a
  251. distributable when you have compiled first, so the distribute target depends on
  252. the compile target. Ant resolves all these dependencies.</p>
  253. <p>Ant tries to execute the targets in the <i>depends</i> attribute in the order
  254. they appear (from left to right). Keep in mind that it is possible that a target
  255. can get executed earlier when an earlier target depends on it:</p>
  256. <blockquote>
  257. <pre>&lt;target name=&quot;A&quot;/&gt;
  258. &lt;target name=&quot;B&quot; depends=&quot;A&quot;/&gt;
  259. &lt;target name=&quot;C&quot; depends=&quot;B&quot;/&gt;
  260. &lt;target name=&quot;D&quot; depends=&quot;C,B,A&quot;/&gt;</pre>
  261. </blockquote>
  262. <p>Suppose we want to execute target D. From its <i>depends</i> attribute, you
  263. might think that first target C, then B and then A is executed. Wrong! C depends
  264. on B, and B depends on A, so first A is executed, then B, then C, and finally D.</p>
  265. <p>A target gets executed only once. Even when more targets depend on it (see
  266. the previous example).</p>
  267. <p>A target has also the ability to perform its execution if (or
  268. unless) a property has been set. This allows, for example, better
  269. control on the building process depending on the state of the system
  270. (java version, OS, command line properties, etc...). To make target
  271. <i>sense</i> this property you should add the <i>if</i> (or
  272. <i>unless</i>) attribute with the name of the property that the target
  273. should react to, for example</p>
  274. <blockquote>
  275. <pre>&lt;target name=&quot;build-module-A&quot; if=&quot;module-A-present&quot;/&gt;</pre>
  276. <pre>&lt;target name=&quot;build-own-fake-module-A&quot; unless=&quot;module-A-present&quot;/&gt;</pre>
  277. </blockquote>
  278. <p>If no <i>if</i> and no <i>unless</i> attribute is present, the target will
  279. always be executed.</p>
  280. <p>It is a good practice to place your <a
  281. href="#tstamp">tstamp</a> tasks in a so called initialization target, on which
  282. all other targets depend. Make sure that that target is always the first one in
  283. the depends list of the other targets. In this manual, most initialization targets
  284. have the name "init".</p>
  285. <p>A target has the following attributes:</p>
  286. <table border="1" cellpadding="2" cellspacing="0">
  287. <tr>
  288. <td valign="top"><b>Attribute</b></td>
  289. <td valign="top"><b>Description</b></td>
  290. <td align="center" valign="top"><b>Required</b></td>
  291. </tr>
  292. <tr>
  293. <td valign="top">name</td>
  294. <td valign="top">the name of the project.</td>
  295. <td align="center" valign="top">Yes</td>
  296. </tr>
  297. <tr>
  298. <td valign="top">depends</td>
  299. <td valign="top">a comma separated list of names of targets on which this
  300. target depends.</td>
  301. <td align="center" valign="top">No</td>
  302. </tr>
  303. <tr>
  304. <td valign="top">if</td>
  305. <td valign="top">the name of the property that must be set in order for this
  306. target to execute.</td>
  307. <td align="center" valign="top">No</td>
  308. </tr>
  309. <tr>
  310. <td valign="top">unless</td>
  311. <td valign="top">the name of the property that must not be set in order
  312. for this target to execute.</td>
  313. <td align="center" valign="top">No</td>
  314. </tr>
  315. </table>
  316. <h3>Tasks</h3>
  317. <p>A task is a piece of code that can be executed.</p>
  318. <p>A task can have multiple attributes (or arguments if you prefer). The value
  319. of an attribute might contain references to a property. These references will be
  320. resolved before the task is executed.</p>
  321. <p>Tasks have a common structure:</p>
  322. <blockquote>
  323. <pre>&lt;name attribute1=&quot;value1&quot; attribute2=&quot;value2&quot; ... /&gt;</pre>
  324. </blockquote>
  325. <p>where name is the name of the task, attribute-x the attribute name, and
  326. value-x the value of this attribute.</p>
  327. <p>There is a set of <a href="#tasks">built in tasks</a>, but it is also very
  328. easy to <a href="#writingowntask">write your own</a>.</p>
  329. <p>All tasks share a <code>taskname</code> attribute. The value of
  330. this attribute will be used in the logging messages generated by
  331. Ant.</p>
  332. <h3>Properties</h3>
  333. <p>A project can have a set of properties. These might be set in the buildfile
  334. by the <a href="#property">property task</a>, or might be set outside Ant. A
  335. property has a name and a value. Properties might be used in in the value of
  336. task attributes. This is done by placing the property name between
  337. &quot;${&quot; and &quot;}&quot; in the attribute value.</p>
  338. <p>If there is a property called &quot;builddir&quot; with the value
  339. &quot;build&quot;, then this could be used in an attribute like this: &quot;${builddir}/classes&quot;.
  340. This is resolved as &quot;build/classes&quot;.</p>
  341. <h3>Token Filters</h3>
  342. <p>A project can have a set of tokens that might be automatically expanded if
  343. found when a file is copied, when the filtering-copy behavior is selected in the
  344. tasks that support this. These might be set in the buildfile
  345. by the <a href="#filter">filter task</a>.&nbsp;</p>
  346. <p>Since this can be a very harmful behavior, the tokens in the files <b>must</b>
  347. be of the form<i> @token@</i> where <i>token</i> is the token name that is set
  348. in the filter task. This token syntax matches the syntax of other build systems
  349. that perform such filtering and remains sufficiently orthogonal to most
  350. programming and scripting languages, as well with documentation systems.</p>
  351. <p>Note: in case a token with the format @token@ if found in a file but no
  352. filter is associated with that token, no changes take place. So, no escaping
  353. method is present, but as long as you choose appropriate names for your tokens,
  354. this should not cause problems.</p>
  355. <h3>Examples</h3>
  356. <blockquote>
  357. <pre>&lt;project name=&quot;foo&quot; default=&quot;dist&quot; basedir=&quot;.&quot;&gt;
  358. &lt;target name=&quot;init&quot;&gt;
  359. &lt;tstamp/&gt;
  360. &lt;property name=&quot;build&quot; value=&quot;build&quot; /&gt;
  361. &lt;property name=&quot;dist&quot; value=&quot;dist&quot; /&gt;
  362. &lt;filter token=&quot;version&quot; value=&quot;1.0.3&quot; /&gt;
  363. &lt;filter token=&quot;year&quot; value=&quot;2000&quot; /&gt;
  364. &lt;/target&gt;
  365. &lt;target name=&quot;prepare&quot; depends=&quot;init&quot;&gt;
  366. &lt;mkdir dir=&quot;${build}&quot; /&gt;
  367. &lt;/target&gt;
  368. &lt;target name=&quot;compile&quot; depends=&quot;prepare&quot;&gt;
  369. &lt;javac srcdir=&quot;${src}&quot; destdir=&quot;${build}&quot; filtering=&quot;on&quot;/&gt;
  370. &lt;/target&gt;
  371. &lt;target name=&quot;dist&quot; depends=&quot;compile&quot;&gt;
  372. &lt;mkdir dir=&quot;${dist}/lib&quot; /&gt;
  373. &lt;jar jarfile=&quot;${dist}/lib/foo${DSTAMP}.jar&quot;
  374. basedir=&quot;${build}&quot; items=&quot;com&quot;/&gt;
  375. &lt;/target&gt;
  376. &lt;target name=&quot;clean&quot; depends=&quot;init&quot;&gt;
  377. &lt;deltree dir=&quot;${build}&quot; /&gt;
  378. &lt;deltree dir=&quot;${dist}&quot; /&gt;
  379. &lt;/target&gt;
  380. &lt;/project&gt;
  381. </pre>
  382. </blockquote>
  383. <hr>
  384. <h2><a name="directorybasedtasks">Directory based tasks</a></h2>
  385. <p>Some tasks use directory trees for the task they perform. For instance, the <a
  386. href="#javac">Javac task</a> which works upon a directory tree with .java files.
  387. Sometimes it can be very useful to work on a subset of that directory tree. This
  388. section describes how you can select a subset of such a directory tree.</p>
  389. <p>Ant gives you two ways to create a subset, both of which can be used at the same
  390. time:</p>
  391. <ul>
  392. <li>Only include files/directories that match at least one pattern of a set of
  393. patterns</li>
  394. <li>Exclude files/directories that match at least one pattern a set of
  395. patterns</li>
  396. </ul>
  397. <p>When both inclusion and exclusion are used, only files/directories that match
  398. the include patterns, and don't match the exclude patterns are used.</p>
  399. <p>Patterns can be specified inside the buildfile via task attributes or
  400. nested elements and via external files. Each line of the external file
  401. is taken as pattern that is added to the list of include or exclude
  402. patterns.</p>
  403. <h3>Patterns</h3>
  404. <p>As described earlier, patterns are used for the inclusion and exclusion.
  405. These patterns look very much like the patterns used in DOS and UNIX:</p>
  406. <p>'*' matches zero or more characters, '?' matches one character.</p>
  407. <p>Examples:</p>
  408. <p>'*.java' matches '.java', 'x.java' and 'FooBar.java', but not 'FooBar.xml'
  409. (does not end with '.java').</p>
  410. <p>'?.java' matches 'x.java', 'A.java', but not '.java' or 'xyz.java' (both
  411. don't have one character before '.java').</p>
  412. <p>Combinations of '*'s and '?'s are allowed.</p>
  413. <p>Matching is done per-directory. This means that first the first directory in
  414. the pattern is matched against the first directory in the path to match. Then
  415. the second directories are matched, and so on. E.g. when we have the pattern '/?abc/*/*.java'
  416. and the path '/xabc/foobar/test.java', then first '?abc' is matched with 'xabc',
  417. then '*' is matched with 'foobar' and finally '*.java' is matched with 'test.java'.
  418. They all match so the path matches the pattern.</p>
  419. <p>Too make things a bit more flexible, we add one extra feature, which makes it
  420. possible to match multiple directory levels. This can be used to match a
  421. complete directory tree, or a file anywhere in the directory tree. To do this, '**'
  422. must be used as the name of a directory. When '**' is used as the name of a
  423. directory in the pattern, it matches zero or more directories. For instance:
  424. '/test/**' matches all files/directories under '/test/', such as '/test/x.java',
  425. or '/test/foo/bar/xyz.html', but not '/xyz.xml'.</p>
  426. <p>There is one &quot;shorthand&quot;, if a pattern ends with '/' or '\', then '**'
  427. is appended. E.g. &quot;mypackage/test/&quot; is interpreted as were it &quot;mypackage/test/**&quot;.</p>
  428. <p>Examples:</p>
  429. <table border="1" cellpadding="2" cellspacing="0">
  430. <tr>
  431. <td valign="top">**/CVS/*</td>
  432. <td valign="top">Matches all files in CVS directories, that can be located
  433. anywhere in the directory tree.
  434. <p>Matches:</p>
  435. <p>CVS/Repository<br>
  436. org/apache/CVS/Entries<br>
  437. org/apache/jakarta/tools/ant/CVS/Entries</p>
  438. <p>But not:</p>
  439. <p>org/apache/CVS/foo/bar/Entries ('foo/bar/' part does not match)</td>
  440. </tr>
  441. <tr>
  442. <td valign="top">org/apache/jakarta/**</td>
  443. <td valign="top">Matches all files in the org/apache/jakarta directory tree.
  444. <p>Matches:</p>
  445. <p>org/apache/jakarta/tools/ant/docs/index.html<br>
  446. org/apache/jakarta/test.xml</p>
  447. <p>But not:</p>
  448. <p>org/apache/xyz.java ('jakarta'/' part is missing)</td>
  449. </tr>
  450. <tr>
  451. <td valign="top">org/apache/**/CVS/*</td>
  452. <td valign="top">Matches all files in CVS directories, that are located
  453. anywhere in the directory tree under org/apache.
  454. <p>Matches:</p>
  455. <p>org/apache/CVS/Entries<br>
  456. org/apache/jakarta/tools/ant/CVS/Entries</p>
  457. <p>But not:</p>
  458. <p>org/apache/CVS/foo/bar/Entries ('foo/bar/' part does not match)</td>
  459. </tr>
  460. <tr>
  461. <td valign="top">**/test/**</td>
  462. <td valign="top">Matches all files which have a directory 'test' in their
  463. path, including 'test' as a filename.</td>
  464. </tr>
  465. </table>
  466. <p>When these patterns are used in inclusion and exclusion, you have a powerful
  467. way to select just the files you want.</p>
  468. <h3>Examples</h3>
  469. <pre> &lt;copydir src=&quot;${src}&quot;
  470. dest=&quot;${dist}&quot;
  471. includes=&quot;**/images/*&quot;
  472. excludes=&quot;**/*.gif&quot; /&gt;</pre>
  473. <p>This copies all files in directories called &quot;images&quot;, that are
  474. located in the directory tree &quot;${src}&quot; to the destination &quot;${dist}&quot;,
  475. but excludes all &quot;*.gif&quot; files from the copy.</p>
  476. <p> This example can also be expressed using nested elements as
  477. <pre> &lt;copydir src=&quot;${src}&quot;
  478. dest=&quot;${dist}&quot;&gt;
  479. &lt;include name=&quot;**/images/*&quot;/&gt;
  480. &lt;exclude name=&quot;**/*.gif&quot; /&gt;
  481. &lt;/copydir&gt;
  482. </pre>
  483. <h3>Default Excludes</h3>
  484. <p>There are a set of definitions which are excluded by default from all directory based tasks.
  485. They are:
  486. <pre> &quot;**/*~&quot;,
  487. &quot;**/#*#&quot;,
  488. &quot;**/%*%&quot;,
  489. &quot;**/CVS&quot;,
  490. &quot;**/CVS/*&quot;,
  491. &quot;**/.cvsignore&quot;
  492. </pre>
  493. If you do not want these default excludes applied, you may disable them with the
  494. <code>defaultexcludes=&quot;no&quot;</code> attribute.</p>
  495. <hr>
  496. <h2><a name="tasks">Built in tasks</a></h2>
  497. <ul>
  498. <li><a href="#ant">Ant</a></li>
  499. <li><a href="#available">Available</a></li>
  500. <li><a href="#chmod">Chmod</a></li>
  501. <li><a href="#copydir">Copydir</a></li>
  502. <li><a href="#copyfile">Copyfile</a></li>
  503. <li><a href="#cvs">Cvs</a></li>
  504. <li><a href="#delete">Delete</a></li>
  505. <li><a href="#deltree">Deltree</a></li>
  506. <li><a href="#echo">Echo</a></li>
  507. <li><a href="#exec">Exec</a></li>
  508. <li><a href="#unzip">Expand</a></li>
  509. <li><a href="#filter">Filter</a></li>
  510. <li><a href="#fixcrlf">FixCRLF</a></li>
  511. <li><a href="#get">Get</a></li>
  512. <li><a href="#gunzip">GUnzip</a></li>
  513. <li><a href="#gzip">GZip</a></li>
  514. <li><a href="#jar">Jar</a></li>
  515. <li><a href="#java">Java</a></li>
  516. <li><a href="#javac">Javac</a></li>
  517. <li><a href="#javadoc">Javadoc/Javadoc2</a></li>
  518. <li><a href="#keysubst">KeySubst</a></li>
  519. <li><a href="#mkdir">Mkdir</a></li>
  520. <li><a href="#patch">Patch</a></li>
  521. <li><a href="#property">Property</a></li>
  522. <li><a href="#rename">Rename</a></li>
  523. <li><a href="#replace">Replace</a></li>
  524. <li><a href="#rmic">Rmic</a></li>
  525. <li><a href="#signjar">SignJar</a></li>
  526. <li><a href="#tar">Tar</a></li>
  527. <li><a href="#taskdef">Taskdef</a></li>
  528. <li><a href="#touch">Touch</a></li>
  529. <li><a href="#tstamp">Tstamp</a></li>
  530. <li><a href="#style">Style</a></li>
  531. <li><a href="#unzip">Unjar</a></li>
  532. <li><a href="#untar">Untar</a></li>
  533. <li><a href="#unzip">Unzip</a></li>
  534. <li><a href="#zip">Zip</a></li>
  535. </ul>
  536. <hr>
  537. <h2><a name="ant">Ant</a></h2>
  538. <h3><b>Description:</b></h3>
  539. <p>Runs Ant on a supplied buildfile. This can be used to build subprojects.</p>
  540. <p>When the <i>antfile</i> attribute is omitted, the file &quot;build.xml&quot;
  541. in the supplied directory (<i>dir</i> attribute) is used.</p>
  542. <p>If no target attribute is supplied, the default target of the new project is
  543. used.</p>
  544. <p>The properties of the current project will be available in the new project.
  545. These properties will override the properties that are set in the new project.
  546. (See also the <a href="#property">properties task</a>).</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">antfile</td>
  556. <td valign="top">the buildfile to use.</td>
  557. <td valign="top" align="center">No</td>
  558. </tr>
  559. <tr>
  560. <td valign="top">dir</td>
  561. <td valign="top">the directory to use as a basedir for the new Ant project.</td>
  562. <td valign="top" align="center">Yes</td>
  563. </tr>
  564. <tr>
  565. <td valign="top">target</td>
  566. <td valign="top">the target of the new Ant project that should be executed.</td>
  567. <td valign="top" align="center">No</td>
  568. </tr>
  569. <tr>
  570. <td valign="top">output</td>
  571. <td valign="top">Filename to write the ant output to.
  572. </td>
  573. <td align="center" valign="top">No</td>
  574. </tr>
  575. </table>
  576. <h3>Examples</h3>
  577. <blockquote>
  578. <p><code>&lt;ant antfile=&quot;subproject/subbuild.xml&quot; dir=&quot;subproject&quot;
  579. target=&quot;compile&quot; /&gt;</code></p>
  580. <p><code>&lt;ant dir=&quot;subproject&quot; /&gt;</code></p>
  581. </blockquote>
  582. <hr>
  583. <h2><a name="available">Available</a></h2>
  584. <h3>Description</h3>
  585. <p>Sets a property if a resource is available at runtime. This resource can be a
  586. file resource, a class in classpath or a JVM system resource.</p>
  587. <p>The value part of the properties being set is <i>true</i> if the resource is
  588. present, otherwise, the property is not set.</p>
  589. <p>Normally, this task is used to set properties that are useful to avoid target
  590. execution depending on system parameters.</p>
  591. <h3>Parameters</h3>
  592. <table border="1" cellpadding="2" cellspacing="0">
  593. <tr>
  594. <td valign="top"><b>Attribute</b></td>
  595. <td valign="top"><b>Description</b></td>
  596. <td align="center" valign="top"><b>Required</b></td>
  597. </tr>
  598. <tr>
  599. <td valign="top">property</td>
  600. <td valign="top">the name of the property to set.</td>
  601. <td valign="top" align="center">Yes</td>
  602. </tr>
  603. <tr>
  604. <td valign="top">classname</td>
  605. <td valign="top">the class to look for in classpath.</td>
  606. <td valign="middle" align="center" rowspan="3">Yes</td>
  607. </tr>
  608. <tr>
  609. <td valign="top">resource</td>
  610. <td valign="top">the resource to look for in the JVM</td>
  611. </tr>
  612. <tr>
  613. <td valign="top">file</td>
  614. <td valign="top">the file to look for.</td>
  615. </tr>
  616. </table>
  617. <h3>Examples</h3>
  618. <pre> &lt;available classname=&quot;org.whatever.Myclass&quot; property=&quot;Myclass.present&quot; /&gt;</pre>
  619. <p>sets the property <code><i>Myclass.present</i></code> to the value &quot;true&quot;
  620. if the <i>org.whatever.Myclass</i> is found in Ant's classpath.</p>
  621. <hr>
  622. <h2><a name="chmod">Chmod</a></h2>
  623. <h3>Description</h3>
  624. <p>Changes the permissions of a file or all files inside a specified directory. Right now it has efect only under Unix.
  625. The permissions are also UNIX style, like the argument for the chmod command.</p>
  626. <p>It is possible to refine the set of files whose permissions are changed. This can be
  627. done with the <i>includes</i>, <i>includesfile</i>, <i>excludes</i>, <i>excludesfile</i> and <i>defaultexcludes</i>
  628. attributes. With the <i>includes</i> or <i>includesfile</i> attribute you specify the files you want to
  629. have included by using patterns. The <i>exclude</i> or <i>excludesfile</i> attribute is used to specify
  630. the files you want to have excluded. This is also done with patterns. And
  631. finally with the <i>defaultexcludes</i> attribute, you can specify whether you
  632. want to use default exclusions or not. See the section on <a
  633. href="#directorybasedtasks">directory based tasks</a>, on how the
  634. inclusion/exclusion of files works, and how to write patterns. The patterns are
  635. relative to the <i>dir</i> directory.</p>
  636. <h3>Parameters</h3>
  637. <table border="1" cellpadding="2" cellspacing="0">
  638. <tr>
  639. <td valign="top"><b>Attribute</b></td>
  640. <td valign="top"><b>Description</b></td>
  641. <td align="center" valign="top"><b>Required</b></td>
  642. </tr>
  643. <tr>
  644. <td valign="top">file</td>
  645. <td valign="top">the file or single directory of which the permissions
  646. must be changed.</td>
  647. <td valign="top" valign="middle" rowspan="2">exactly one of the two</td>
  648. </tr>
  649. <tr>
  650. <td valign="top">dir</td>
  651. <td valign="top">the directory which holds the files whose permissions
  652. must be changed.</td>
  653. </tr>
  654. <tr>
  655. <td valign="top">src</td>
  656. <td valign="top">the file or single directory of which the permissions
  657. must be changed (<b>deprecated</b>, use <i>file</i> instead).</td>
  658. <td valign="top" align="center">No</td>
  659. </tr>
  660. <tr>
  661. <td valign="top">perm</td>
  662. <td valign="top">the new permissions.</td>
  663. <td valign="top" align="center">Yes</td>
  664. </tr>
  665. <tr>
  666. <td valign="top">includes</td>
  667. <td valign="top">comma separated list of patterns of files that must be
  668. included. All files are included when omitted.</td>
  669. <td valign="top" align="center">No</td>
  670. </tr>
  671. <tr>
  672. <td valign="top">includesfile</td>
  673. <td valign="top">the name of a file. Each line of this file is
  674. taken to be an include pattern</td>
  675. <td valign="top" align="center">No</td>
  676. </tr>
  677. <tr>
  678. <td valign="top">excludes</td>
  679. <td valign="top">comma separated list of patterns of files that must be
  680. excluded. No files (except default excludes) are excluded when omitted.</td>
  681. <td valign="top" align="center">No</td>
  682. </tr>
  683. <tr>
  684. <td valign="top">excludesfile</td>
  685. <td valign="top">the name of a file. Each line of this file is
  686. taken to be an exclude pattern</td>
  687. <td valign="top" align="center">No</td>
  688. </tr>
  689. <tr>
  690. <td valign="top">defaultexcludes</td>
  691. <td valign="top">indicates whether default excludes should be used or not
  692. (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when omitted.</td>
  693. <td valign="top" align="center">No</td>
  694. </tr>
  695. </table>
  696. <h3>Examples</h3>
  697. <blockquote>
  698. <p><code>&lt;chmod file=&quot;${dist}/start.sh&quot; perm=&quot;ugo+rx&quot;
  699. /&gt;</code></p>
  700. </blockquote>
  701. <p>makes the &quot;start.sh&quot; file readable and executable for anyone on a
  702. UNIX system.</p>
  703. <pre>
  704. &lt;chmod dir=&quot;${dist}/bin&quot; perm=&quot;ugo+rx&quot; includes="**/*.sh" /&gt;
  705. </pre>
  706. </blockquote>
  707. <p>makes all &quot;.sh&quot; files below <code>${dist}/bin</code>
  708. readable and executable for anyone on a UNIX system.</p>
  709. <hr>
  710. <h2><a name="copydir">Copydir</a></h2>
  711. <h3>Description</h3>
  712. <p>Copies a directory tree from the source to the destination.</p>
  713. <p>It is possible to refine the set of files that are being copied. This can be
  714. done with the <i>includes</i>, <i>includesfile</i>, <i>excludes</i>, <i>excludesfile</i> and <i>defaultexcludes</i>
  715. attributes. With the <i>includes</i> or <i>includesfile</i> attribute you specify the files you want to
  716. have included by using patterns. The <i>exclude</i> or <i>excludesfile</i> attribute is used to specify
  717. the files you want to have excluded. This is also done with patterns. And
  718. finally with the <i>defaultexcludes</i> attribute, you can specify whether you
  719. want to use default exclusions or not. See the section on <a
  720. href="#directorybasedtasks">directory based tasks</a>, on how the
  721. inclusion/exclusion of files works, and how to write patterns. The patterns are
  722. relative to the <i>src</i> directory.</p>
  723. <p>The <i>ignore</i> attribute contains the names of the files/directories that
  724. must be excluded from the copy. The names specified in the <i>ignore</i>
  725. attribute are just names, they do not contain any path information! Note that
  726. this attribute has been replaced by the <i>excludes</i> attribute.</p>
  727. <h3>Parameters</h3>
  728. <table border="1" cellpadding="2" cellspacing="0">
  729. <tr>
  730. <td valign="top"><b>Attribute</b></td>
  731. <td valign="top"><b>Description</b></td>
  732. <td align="center" valign="top"><b>Required</b></td>
  733. </tr>
  734. <tr>
  735. <td valign="top">src</td>
  736. <td valign="top">the directory to copy.</td>
  737. <td valign="top" align="center">Yes</td>
  738. </tr>
  739. <tr>
  740. <td valign="top">dest</td>
  741. <td valign="top">the directory to copy to.</td>
  742. <td valign="top" align="center">Yes</td>
  743. </tr>
  744. <tr>
  745. <td valign="top">ignore</td>
  746. <td valign="top">comma separated list of filenames/directorynames to ignore.
  747. No files (except default excludes) are excluded when omitted. (<b>deprecated</b>,
  748. use <i>excludes</i> instead).</td>
  749. <td valign="top" align="center">No</td>
  750. </tr>
  751. <tr>
  752. <td valign="top">includes</td>
  753. <td valign="top">comma separated list of patterns of files that must be
  754. included. All files are included when omitted.</td>
  755. <td valign="top" align="center">No</td>
  756. </tr>
  757. <tr>
  758. <td valign="top">includesfile</td>
  759. <td valign="top">the name of a file. Each line of this file is
  760. taken to be an include pattern</td>
  761. <td valign="top" align="center">No</td>
  762. </tr>
  763. <tr>
  764. <td valign="top">excludes</td>
  765. <td valign="top">comma separated list of patterns of files that must be
  766. excluded. No files (except default excludes) are excluded when omitted.</td>
  767. <td valign="top" align="center">No</td>
  768. </tr>
  769. <tr>
  770. <td valign="top">excludesfile</td>
  771. <td valign="top">the name of a file. Each line of this file is
  772. taken to be an exclude pattern</td>
  773. <td valign="top" align="center">No</td>
  774. </tr>
  775. <tr>
  776. <td valign="top">defaultexcludes</td>
  777. <td valign="top">indicates whether default excludes should be used or not
  778. (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when omitted.</td>
  779. <td valign="top" align="center">No</td>
  780. </tr>
  781. <tr>
  782. <td valign="top">filtering</td>
  783. <td valign="top">indicates whether token filtering should take place during
  784. the copy</td>
  785. <td valign="top" align="center">No</td>
  786. </tr>
  787. <tr>
  788. <td valign="top">forceoverwrite</td>
  789. <td valign="top">overwrite existing files even if the destination
  790. files are newer (default is false).</td>
  791. <td valign="top" align="center">No</td>
  792. </tr>
  793. </table>
  794. <h3>Examples</h3>
  795. <pre> &lt;copydir src=&quot;${src}/resources&quot;
  796. dest=&quot;${dist}&quot;
  797. /&gt;</pre>
  798. <p>copies the directory <code>${src}/resources</code> to <code>${dist}</code>.</p>
  799. <pre> &lt;copydir src=&quot;${src}/resources&quot;
  800. dest=&quot;${dist}&quot;
  801. includes=&quot;**/*.java&quot;
  802. excludes=&quot;**/Test.java&quot;
  803. /&gt;</pre>
  804. <p>copies the directory <code>${src}/resources</code> to <code>${dist}</code>
  805. recursively. All java files are copied, except for files with the name <code>Test.java</code>.</p>
  806. <pre> &lt;copydir src=&quot;${src}/resources&quot;
  807. dest=&quot;${dist}&quot;
  808. includes=&quot;**/*.java&quot;
  809. excludes=&quot;mypackage/test/**&quot; /&gt;</pre>
  810. <p>copies the directory <code>${src}/resources</code> to <code>${dist}</code>
  811. recursively. All java files are copied, except for the files under the <code>mypackage/test</code>
  812. directory.</p>
  813. <hr>
  814. <h2><a name="copyfile">Copyfile</a></h2>
  815. <h3>Description</h3>
  816. <p>Copies a file from the source to the destination. The file is only copied if
  817. the source file is newer than the destination file, or when the destination file
  818. does not exist.</p>
  819. <h3>Parameters</h3>
  820. <table border="1" cellpadding="2" cellspacing="0">
  821. <tr>
  822. <td valign="top"><b>Attribute</b></td>
  823. <td valign="top"><b>Description</b></td>
  824. <td align="center" valign="top"><b>Required</b></td>
  825. </tr>
  826. <tr>
  827. <td valign="top">src</td>
  828. <td valign="top">the filename of the file to copy.</td>
  829. <td valign="top" align="center">Yes</td>
  830. </tr>
  831. <tr>
  832. <td valign="top">dest</td>
  833. <td valign="top">the filename of the file where to copy to.</td>
  834. <td valign="top" align="center">Yes</td>
  835. </tr>
  836. <tr>
  837. <td valign="top">filtering</td>
  838. <td valign="top">indicates whether token filtering should take place during
  839. the copy</td>
  840. <td valign="top" align="center">No</td>
  841. </tr>
  842. </table>
  843. <h3>Examples</h3>
  844. <blockquote>
  845. <p><code>&lt;copyfile src=&quot;test.java&quot; dest=&quot;subdir/test.java&quot;
  846. /&gt;</code></p>
  847. <p><code>&lt;copyfile src=&quot;${src}/index.html&quot; dest=&quot;${dist}/help/index.html&quot;
  848. /&gt;</code></p>
  849. </blockquote>
  850. <hr>
  851. <h2><a name="cvs">Cvs</a></h2>
  852. <h3>Description</h3>
  853. <p>Handles packages/modules retrieved from a
  854. <a href="http://www.cyclic.com/">CVS</a> repository.</p>
  855. <p>When doing automated builds, the <a href="#get">get task</a> should be
  856. preferred over the <i>checkout</i> command, because of speed.</p>
  857. <h3>Parameters</h3>
  858. <table border="1" cellpadding="2" cellspacing="0">
  859. <tr>
  860. <td valign="top"><b>Attribute</b></td>
  861. <td valign="top"><b>Description</b></td>
  862. <td align="center" valign="top"><b>Required</b></td>
  863. </tr>
  864. <tr>
  865. <td valign="top">command</td>
  866. <td valign="top">the CVS command to execute.</td>
  867. <td align="center" valign="top">No, default &quot;checkout&quot;</td>
  868. </tr>
  869. <tr>
  870. <td valign="top">cvsRoot</td>
  871. <td valign="top">the CVSROOT variable.</td>
  872. <td align="center" valign="top">No</td>
  873. </tr>
  874. <tr>
  875. <td valign="top">dest</td>
  876. <td valign="top">the directory where the checked out files should be placed.</td>
  877. <td align="center" valign="top">Yes</td>
  878. </tr>
  879. <tr>
  880. <td valign="top">package</td>
  881. <td valign="top">the package/module to check out.</td>
  882. <td align="center" valign="top">No</td>
  883. </tr>
  884. <tr>
  885. <td valign="top">tag</td>
  886. <td valign="top">the tag of the package/module to check out.</td>
  887. <td align="center" valign="top">No</td>
  888. </tr>
  889. <tr>
  890. <td valign="top">date</td>
  891. <td valign="top">Use the most recent revision no later than the given date</td>
  892. <td align="center" valign="top">No</td>
  893. </tr>
  894. <tr>
  895. <td valign="top">quiet</td>
  896. <td valign="top">supress informational messages.</td>
  897. <td align="center" valign="top">No, default &quot;false&quot;</td>
  898. </tr>
  899. <tr>
  900. <td valign="top">noexec</td>
  901. <td valign="top">report only, don't change any files.</td>
  902. <td align="center" valign="top">No, default &quot;false&quot;</td>
  903. </tr>
  904. <tr>
  905. <td valign="top">failonerror</td>
  906. <td valign="top">Stop the buildprocess if the command exits with a
  907. returncode other than 0.</td>
  908. <td align="center" valign="top">No</td>
  909. </tr>
  910. </table>
  911. <h3>Examples</h3>
  912. <pre> &lt;cvs cvsRoot=&quot;:pserver:anoncvs@jakarta.apache.org:/home/cvspublic&quot;
  913. package=&quot;jakarta-tools&quot;
  914. dest=&quot;${ws.dir}&quot;
  915. /&gt;</pre>
  916. <p>checks out the package/module &quot;jakarta-tools&quot; from the CVS
  917. repository pointed to by the cvsRoot attribute, and stores the files in &quot;${ws.dir}&quot;.</p>
  918. <pre> &lt;cvs dest=&quot;${ws.dir}&quot; command=&quot;update&quot; /&gt;</pre>
  919. <p>updates the package/module that has previously been checked out into
  920. &quot;${ws.dir}&quot;.</p>
  921. <hr>
  922. <h2><a name="delete">Delete</a></h2>
  923. <h3>Description</h3>
  924. <p>Deletes either a single file or
  925. all files in a specified directory and its sub-directories.</p>
  926. <p>It is possible to refine the set of files that are being deleted. This can be
  927. done with the <i>includes</i>, <i>includesfile</i>, <i>excludes</i>, <i>excludesfile</i> and <i>defaultexcludes</i>
  928. attributes. With the <i>includes</i> or <i>includesfile</i> attribute you specify the files you want to
  929. have included in the deletion process by using patterns. The <i>exclude</i> or <i>excludesfile</i> attribute is used to specify
  930. the files you want to have excluded from the deletion process. This is also done with patterns. And
  931. finally with the <i>defaultexcludes</i> attribute, you can specify whether you
  932. want to use default exclusions or not. See the section on <a
  933. href="#directorybasedtasks">directory based tasks</a>, on how the
  934. inclusion/exclusion of files works, and how to write patterns. The patterns are
  935. relative to the <i>dir</i> directory.</p>
  936. <h3>Parameters</h3>
  937. <table border="1" cellpadding="2" cellspacing="0">
  938. <tr>
  939. <td valign="top"><b>Attribute</b></td>
  940. <td valign="top"><b>Description</b></td>
  941. <td align="center" valign="top"><b>Required</b></td>
  942. </tr>
  943. <tr>
  944. <td valign="top">file</td>
  945. <td valign="top">The file to delete.</td>
  946. <td align="center" valign="middle" rowspan="2">at least one of the two</td>
  947. </tr>
  948. <tr>
  949. <td valign="top">dir</td>
  950. <td valign="top">The directory to delete files from.</td>
  951. </tr>
  952. <tr>
  953. <td valign="top">includes</td>
  954. <td valign="top">Comma separated list of patterns of files that must be
  955. deleted. All files are in the current directory
  956. and any sub-directories are deleted when omitted.</td>
  957. <td valign="top" align="center">No</td>
  958. </tr>
  959. <tr>
  960. <td valign="top">includesfile</td>
  961. <td valign="top">the name of a file. Each line of this file is
  962. taken to be an include pattern</td>
  963. <td valign="top" align="center">No</td>
  964. </tr>
  965. <tr>
  966. <td valign="top">excludes</td>
  967. <td valign="top">Comma separated list of patterns of files that must be
  968. excluded from the deletion list. No files (except default excludes) are excluded when omitted.</td>
  969. <td valign="top" align="center">No</td>
  970. </tr>
  971. <tr>
  972. <td valign="top">excludesfile</td>
  973. <td valign="top">the name of a file. Each line of this file is
  974. taken to be an exclude pattern</td>
  975. <td valign="top" align="center">No</td>
  976. </tr>
  977. <tr>
  978. <td valign="top">defaultexcludes</td>
  979. <td valign="top">Indicates whether default excludes should be used or not
  980. (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when omitted.</td>
  981. <td valign="top" align="center">No</td>
  982. </tr>
  983. <tr>
  984. <td valign="top">verbose</td>
  985. <td valign="top">Show name of each deleted file (&quot;true&quot;/&quot;false&quot;). Default is "false" when omitted.</td>
  986. <td align="center" valign="top">No</td>
  987. </tr>
  988. </table>
  989. <h3>Examples</h3>
  990. <pre> &lt;delete file=&quot;/lib/ant.jar&quot; /&gt;</pre>
  991. <p>deletes the file <code>/lib/ant.jar</code>.</p>
  992. <pre> &lt;delete dir=&quot;lib&quot; /&gt;</pre>
  993. <p>deletes all files in the <code>/lib</code> directory.</p>
  994. <pre> &lt;delete dir=&quot;.&quot;
  995. include=&quot;**/*.bak&quot;
  996. /&gt;
  997. </pre>
  998. <p>deletes all files with the extension &quot;<code>.bak</code>&quot from the current directory
  999. and any sub-directories.</p>
  1000. <h2><a name="deltree">Deltree</a></h2>
  1001. <h3>Description</h3>
  1002. <p>Deletes a directory with all its files and subdirectories.</p>
  1003. <h3>Parameters</h3>
  1004. <table border="1" cellpadding="2" cellspacing="0">
  1005. <tr>
  1006. <td valign="top"><b>Attribute</b></td>
  1007. <td valign="top"><b>Description</b></td>
  1008. <td align="center" valign="top"><b>Required</b></td>
  1009. </tr>
  1010. <tr>
  1011. <td valign="top">dir</td>
  1012. <td valign="top">the directory to delete.</td>
  1013. <td valign="top" align="center">Yes</td>
  1014. </tr>
  1015. </table>
  1016. <h3>Examples</h3>
  1017. <pre> &lt;deltree dir=&quot;dist&quot; /&gt;</pre>
  1018. <p>deletes the directory <code>dist</code>, including its files and
  1019. subdirectories.</p>
  1020. <pre> &lt;deltree dir=&quot;${dist}&quot; /&gt;</pre>
  1021. <p>deletes the directory <code>${dist}</code>, including its files and
  1022. subdirectories.</p>
  1023. <hr>
  1024. <h2><a name="echo">Echo</a></h2>
  1025. <h3>Description</h3>
  1026. <p>Echoes a message to System.out.</p>
  1027. <h3>Parameters</h3>
  1028. <table border="1" cellpadding="2" cellspacing="0">
  1029. <tr>
  1030. <td valign="top"><b>Attribute</b></td>
  1031. <td valign="top"><b>Description</b></td>
  1032. <td align="center" valign="top"><b>Required</b></td>
  1033. </tr>
  1034. <tr>
  1035. <td valign="top">message</td>
  1036. <td valign="top">the message to echo.</td>
  1037. <td valign="top" align="center">Yes</td>
  1038. </tr>
  1039. </table>
  1040. <h3>Examples</h3>
  1041. <pre> &lt;echo message=&quot;Hello world&quot; /&gt;</pre>
  1042. <hr>
  1043. <h2><a name="exec">Exec</a></h2>
  1044. <h3>Description</h3>
  1045. <p>Executes a system command. When the <i>os</i> attribute is specified, then
  1046. the command is only executed when Ant is run on one of the specified operating
  1047. systems.</p>
  1048. <h3>Parameters</h3>
  1049. <table border="1" cellpadding="2" cellspacing="0">
  1050. <tr>
  1051. <td valign="top"><b>Attribute</b></td>
  1052. <td valign="top"><b>Description</b></td>
  1053. <td align="center" valign="top"><b>Required</b></td>
  1054. </tr>
  1055. <tr>
  1056. <td valign="top">command</td>
  1057. <td valign="top">the command to execute.</td>
  1058. <td align="center" valign="top">Yes</td>
  1059. </tr>
  1060. <tr>
  1061. <td valign="top">dir</td>
  1062. <td valign="top">the directory in which the command should be executed.</td>
  1063. <td align="center" valign="top">Yes</td>
  1064. </tr>
  1065. <tr>
  1066. <td valign="top">os</td>
  1067. <td valign="top">list of Operating Systems on which the command may be
  1068. executed.</td>
  1069. <td align="center" valign="top">No</td>
  1070. </tr>
  1071. <tr>
  1072. <td valign="top">output</td>
  1073. <td valign="top">the file to which the output of the command should be
  1074. redirected.</td>
  1075. <td align="center" valign="top">Yes</td>
  1076. </tr>
  1077. <tr>
  1078. <td valign="top">failonerror</td>
  1079. <td valign="top">Stop the buildprocess if the command exits with a
  1080. returncode other than 0.</td>
  1081. <td align="center" valign="top">No</td>
  1082. </tr>
  1083. </table>
  1084. <h3>Examples</h3>
  1085. <blockquote>
  1086. <p><code>&lt;exec dir=&quot;${src}&quot; command=&quot;dir&quot; os=&quot;windows&quot;
  1087. output=&quot;dir.txt&quot; /&gt;</code></p>
  1088. </blockquote>
  1089. <hr>
  1090. <h2><a name="unzip">Expand/Unzip/Unjar</a></h2>
  1091. <h3>Description</h3>
  1092. <p>Unzips a zip- or jarfile.</p>
  1093. <p>For JDK 1.1 "last modified time" field is set to current time instead of being
  1094. carried from zipfile.</p>
  1095. <p>DEPRECATION: the expand task simply points to the unzip task and it's
  1096. there for back compatibility reasons.</p>
  1097. <h3>Parameters</h3>
  1098. <table border="1" cellpadding="2" cellspacing="0">
  1099. <tr>
  1100. <td valign="top"><b>Attribute</b></td>
  1101. <td valign="top"><b>Description</b></td>
  1102. <td align="center" valign="top"><b>Required</b></td>
  1103. </tr>
  1104. <tr>
  1105. <td valign="top">src</td>
  1106. <td valign="top">zipfile to expand.</td>
  1107. <td align="center" valign="top">Yes</td>
  1108. </tr>
  1109. <tr>
  1110. <td valign="top">dest</td>
  1111. <td valign="top">directory where to store the expanded files.</td>
  1112. <td align="center" valign="top">Yes</td>
  1113. </tr>
  1114. </table>
  1115. <h3>Examples</h3>
  1116. <blockquote>
  1117. <p><code>&lt;unzip src=&quot;${tomcat_src}/tools-src.zip&quot; dest=&quot;${tools.home}&quot;
  1118. /&gt;</code></p>
  1119. </blockquote>
  1120. <hr>
  1121. <h2><a name="filter">Filter</a></h2>
  1122. <h3>Description</h3>
  1123. <p>Sets a token filter for this project. Token filters are used by all tasks
  1124. that perform file copying operations through the Project commodity methods.</p>
  1125. <p>Note: the token string must not contain the separators chars (@).</p>
  1126. <h3>Parameters</h3>
  1127. <table border="1" cellpadding="2" cellspacing="0">
  1128. <tr>
  1129. <td valign="top"><b>Attribute</b></td>
  1130. <td valign="top"><b>Description</b></td>
  1131. <td align="center" valign="top"><b>Required</b></td>
  1132. </tr>
  1133. <tr>
  1134. <td valign="top">token</td>
  1135. <td valign="top">the token string without @</td>
  1136. <td align="center" valign="top">Yes</td>
  1137. </tr>
  1138. <tr>
  1139. <td valign="top">value</td>
  1140. <td valign="top">the string that should be put to replace the token when the
  1141. file is copied</td>
  1142. <td align="center" valign="top">Yes</td>
  1143. </tr>
  1144. </table>
  1145. <h3>Examples</h3>
  1146. <pre> &lt;filter token=&quot;year&quot; value=&quot;2000&quot; /&gt;
  1147. &lt;copydir src=&quot;${src.dir}&quot; dest=&quot;${dest.dir}&quot;/&gt;</pre>
  1148. <p>will copy recursively all the files from the <i>src.dir</i> directory into
  1149. the <i>dest.dir</i> directory replacing all the occurencies of the string <i>@year@</i>
  1150. with <i>2000.</i></p>
  1151. <hr>
  1152. <h2><a name="fixcrlf">FixCRLF</a></h2>
  1153. <h3>Description</h3>
  1154. <p>Adjusts a text file to local.</p>
  1155. <p>It is possible to refine the set of files that are being adjusted. This can be
  1156. done with the <i>includes</i>, <i>includesfile</i>, <i>excludes</i>, <i>excludesfile</i> and <i>defaultexcludes</i>
  1157. attributes. With the <i>includes</i> or <i>includesfile</i> attribute you specify the files you want to
  1158. have included by using patterns. The <i>exclude</i> or <i>excludesfile</i> attribute is used to specify
  1159. the files you want to have excluded. This is also done with patterns. And
  1160. finally with the <i>defaultexcludes</i> attribute, you can specify whether you
  1161. want to use default exclusions or not. See the section on <a
  1162. href="#directorybasedtasks">directory based tasks</a>, on how the
  1163. inclusion/exclusion of files works, and how to write patterns. The patterns are
  1164. relative to the <i>src</i> directory.</p>
  1165. <h3>Parameters</h3>
  1166. <table border="1" cellpadding="2" cellspacing="0">
  1167. <tr>
  1168. <td valign="top"><b>Attribute</b></td>
  1169. <td valign="top"><b>Description</b></td>
  1170. <td align="center" valign="top"><b>Required</b></td>
  1171. </tr>
  1172. <tr>
  1173. <td valign="top">srcDir</td>
  1174. <td valign="top">Where to find the files to be fixed up.</td>
  1175. <td valign="top" align="center">Yes</td>
  1176. </tr>
  1177. <tr>
  1178. <td valign="top">destDir</td>
  1179. <td valign="top">Where to place the corrected files. Defaults to
  1180. srcDir (replacing the original file)</td>
  1181. <td valign="top" align="center">No</td>
  1182. </tr>
  1183. <tr>
  1184. <td valign="top">includes</td>
  1185. <td valign="top">comma separated list of patterns of files that must be
  1186. included. All files are included when omitted.</td>
  1187. <td valign="top" align="center">No</td>
  1188. </tr>
  1189. <tr>
  1190. <td valign="top">includesfile</td>
  1191. <td valign="top">the name of a file. Each line of this file is
  1192. taken to be an include pattern</td>
  1193. <td valign="top" align="center">No</td>
  1194. </tr>
  1195. <tr>
  1196. <td valign="top">excludes</td>
  1197. <td valign="top">comma separated list of patterns of files that must be
  1198. excluded. No files (except default excludes) are excluded when omitted.</td>
  1199. <td valign="top" align="center">No</td>
  1200. </tr>
  1201. <tr>
  1202. <td valign="top">excludesfile</td>
  1203. <td valign="top">the name of a file. Each line of this file is
  1204. taken to be an exclude pattern</td>
  1205. <td valign="top" align="center">No</td>
  1206. </tr>
  1207. <tr>
  1208. <td valign="top">defaultexcludes</td>
  1209. <td valign="top">indicates whether default excludes should be used or not
  1210. (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when omitted.</td>
  1211. <td valign="top" align="center">No</td>
  1212. </tr>
  1213. <tr>
  1214. <td valign="top">cr</td>
  1215. <td valign="top">Specifies how carriage return (CR) characters are to
  1216. be handled. Valid values for this property are:
  1217. <ul>
  1218. <li>add: ensure that there is a CR before every LF
  1219. <li>asis: leave CR characters alone
  1220. <li>remove: remove all CR characters
  1221. </ul>
  1222. Default is based on the platform on which you are running this task.
  1223. For Unix platforms, the default is remove. For DOS based systems
  1224. (including Windows), the default is add.
  1225. <p>
  1226. Note: Unless this property is specified as "asis", extra CR characters
  1227. which do not preceed a LF will be removed.
  1228. </td>
  1229. <td valign="top" align="center">No</td>
  1230. </tr>
  1231. <tr>
  1232. <td valign="top">tab</td>
  1233. <td valign="top">Specifies how tab characters are to be handled. Valid
  1234. values for this property are:
  1235. <ul>
  1236. <li>add: convert sequences of spaces which span a tab stop to tabs
  1237. <li>asis: leave tab and space characters alone
  1238. <li>remove: convert tabs to spaces
  1239. </ul>
  1240. Default for this parameter is "asis".
  1241. <p>
  1242. Note: Unless this property is specified as "asis", extra spaces and
  1243. tabs after the last non-whitespace character on the line will be removed.
  1244. </td>
  1245. <td valign="top" align="center">No</td>
  1246. </tr>
  1247. <tr>
  1248. <td valign="top">tablength</td>
  1249. <td valign="top">The number of characters a TAB stop corresponds to.
  1250. Must be a positive power of 2, default for this parameter is 8.</td>
  1251. <td valign="top" align="center">No</td>
  1252. </tr>
  1253. <tr>
  1254. <td valign="top">eof</td>
  1255. <td valign="top">Specifies how DOS end of file (control-Z) characters are
  1256. to be handled. Valid values for this property are:
  1257. <ul>
  1258. <li>add: ensure that there is an EOF character at the end of the file
  1259. <li>asis: leave EOF characters alone
  1260. <li>remove: remove any EOF character found at the end
  1261. </ul>
  1262. Default is based on the platform on which you are running this task.
  1263. For Unix platforms, the default is remove. For DOS based systems
  1264. (including Windows), the default is asis.
  1265. </td>
  1266. <td valign="top" align="center">No</td>
  1267. </tr>
  1268. </table>
  1269. <h3>Examples</h3>
  1270. <pre> &lt;fixcrlf srcdir=&quot;${src}&quot;
  1271. cr=&quot;remove&quot; eof=&quot;remove&quot;
  1272. includes=&quot;**/*.sh&quot;
  1273. /&gt;</pre>
  1274. <p>Removes carriage return and eof characters from the shell scripts. Tabs and
  1275. spaces are left as is.
  1276. <pre> &lt;fixcrlf srcdir=&quot;${src}&quot;
  1277. cr=&quot;add&quot;
  1278. includes=&quot;**/*.bat&quot;
  1279. /&gt;</pre>
  1280. <p>Ensures that there are carriage return characters prior to evey line feed.
  1281. Tabs and spaces are left as is.
  1282. EOF characters are left alone if run on
  1283. DOS systems, and are removed if run on Unix systems.</p>
  1284. <pre> &lt;fixcrlf srcdir=&quot;${src}&quot;
  1285. tabs=&quot;add&quot;
  1286. includes=&quot;**/Makefile&quot;
  1287. /&gt;</pre>
  1288. <p>Adds or removes CR characters to match local OS conventions, and
  1289. converts spaces to tabs when appropriate. EOF characters are left alone if
  1290. run on DOS systems, and are removed if run on Unix systems.
  1291. Many versions of make require tabs prior to commands.</p>
  1292. <pre> &lt;fixcrlf srcdir=&quot;${src}&quot;
  1293. tabs=&quot;remove&quot;
  1294. includes=&quot;**/README*&quot;
  1295. /&gt;</pre>
  1296. <p>Adds or removes CR characters to match local OS conventions, and
  1297. converts all tabs to spaces. EOF characters are left alone if run on
  1298. DOS systems, and are removed if run on Unix systems.
  1299. You never know what editor a user will use to browse README's.</p>
  1300. <hr>
  1301. <h2><a name="get">Get</a></h2>
  1302. <h3>Description</h3>
  1303. <p>Gets a file from an URL. When the verbose option is &quot;on&quot;, this task
  1304. displays a '.' for every 100 Kb retrieved.</p>
  1305. <p>This task should be preferred above the <a href="#cvs">CVS task</a> when
  1306. doing automated builds. CVS is significant slower than loading a compressed
  1307. archive with http/ftp.</p>
  1308. <h3>Parameters</h3>
  1309. <table border="1" cellpadding="2" cellspacing="0">
  1310. <tr>
  1311. <td valign="top"><b>Attribute</b></td>
  1312. <td valign="top"><b>Description</b></td>
  1313. <td align="center" valign="top"><b>Required</b></td>
  1314. </tr>
  1315. <tr>
  1316. <td valign="top">src</td>
  1317. <td valign="top">the URL from which to retrieve a file.</td>
  1318. <td align="center" valign="top">Yes</td>
  1319. </tr>
  1320. <tr>
  1321. <td valign="top">dest</td>
  1322. <td valign="top">the file where to store the retrieved file.</td>
  1323. <td align="center" valign="top">Yes</td>
  1324. </tr>
  1325. <tr>
  1326. <td valign="top">verbose</td>
  1327. <td valign="top">show verbose information (&quot;on&quot;/&quot;off&quot;).</td>
  1328. <td align="center" valign="top">No</td>
  1329. </tr>
  1330. <tr>
  1331. <td valign="top">ignoreerrors</td>
  1332. <td valign="top">Log errors but don't treat as fatal.</td>
  1333. <td align="center" valign="top">No</td>
  1334. </tr>
  1335. </table>
  1336. <h3>Examples</h3>
  1337. <pre> &lt;get src=&quot;http://jakarta.apache.org/&quot; dest=&quot;help/index.html&quot; /&gt;</pre>
  1338. <p>gets the index page of http://jakarta.apache.org/, and stores it in the file <code>help/index.html</code>.</p>
  1339. <hr>
  1340. <h2><a name="gunzip">GUnzip</a></h2>
  1341. <h3>Description</h3>
  1342. <p>Expands a GZip file.</p>
  1343. <p>If <i>dest</i> is a directory the name of the destination file is
  1344. the same as <i>src</i> (with the &quot;.gz&quot; extension removed if
  1345. present). If <i>dest</i> is ommited, the parent dir of <i>src</i> is
  1346. taken. The file is only expanded if the source file is newer than the
  1347. destination file, or when the destination file does not exist.</p>
  1348. <h3>Parameters</h3>
  1349. <table border="1" cellpadding="2" cellspacing="0">
  1350. <tr>
  1351. <td valign="top"><b>Attribute</b></td>
  1352. <td valign="top"><b>Description</b></td>
  1353. <td align="center" valign="top"><b>Required</b></td>
  1354. </tr>
  1355. <tr>
  1356. <td valign="top">src</td>
  1357. <td valign="top">the file to expand.</td>
  1358. <td align="center" valign="top">Yes</td>
  1359. </tr>
  1360. <tr>
  1361. <td valign="top">dest</td>
  1362. <td valign="top">the destination file or directory.</td>
  1363. <td align="center" valign="top">No</td>
  1364. </tr>
  1365. </table>
  1366. <h3>Examples</h3>
  1367. <blockquote>
  1368. <p><code>&lt;gunzip src=&quot;test.tar.gz&quot;/&gt;</code></p>
  1369. </blockquote>
  1370. <p>expands <i>test.tar.gz</i> to <i>test.tar</i></p>
  1371. <blockquote>
  1372. <p><code>&lt;gunzip src=&quot;test.tar.gz&quot; dest=&quot;test2.tar&quot;/&gt;</code></p>
  1373. </blockquote>
  1374. <p>expands <i>test.tar.gz</i> to <i>test2.tar</i></p>
  1375. <blockquote>
  1376. <p><code>&lt;gunzip src=&quot;test.tar.gz&quot; dest=&quot;subdir&quot;/&gt;</code></p>
  1377. </blockquote>
  1378. <p>expands <i>test.tar.gz</i> to <i>subdir/test.tar</i> (assuming
  1379. subdir is a directory).</p>
  1380. <hr>
  1381. <h2><a name="gzip">GZip</a></h2>
  1382. <h3>Description</h3>
  1383. <p>GZips a file.</p>
  1384. <h3>Parameters</h3>
  1385. <table border="1" cellpadding="2" cellspacing="0">
  1386. <tr>
  1387. <td valign="top"><b>Attribute</b></td>
  1388. <td valign="top"><b>Description</b></td>
  1389. <td align="center" valign="top"><b>Required</b></td>
  1390. </tr>
  1391. <tr>
  1392. <td valign="top">src</td>
  1393. <td valign="top">the file to gzip.</td>
  1394. <td align="center" valign="top">Yes</td>
  1395. </tr>
  1396. <tr>
  1397. <td valign="top">zipfile</td>
  1398. <td valign="top">the destination file.</td>
  1399. <td align="center" valign="top">Yes</td>
  1400. </tr>
  1401. </table>
  1402. <h3>Examples</h3>
  1403. <blockquote>
  1404. <p><code>&lt;gzip src=&quot;test.tar&quot; zipfile=&quot;test.tar.gz&quot;
  1405. /&gt;</code></p>
  1406. </blockquote>
  1407. <hr>
  1408. <h2><a name="jar">Jar</a></h2>
  1409. <h3>Description</h3>
  1410. <p>Jars a set of files.</p>
  1411. <p>The <i>basedir</i> attribute is the reference directory from where to jar.</p>
  1412. <p>It is possible to refine the set of files that are being jarred. This can be
  1413. done with the <i>includes</i>, <i>includesfile</i>, <i>excludes</i>, <i>excludesfile</i> and <i>defaultexcludes</i>
  1414. attributes. With the <i>includes</i> or <i>includesfile</i> attribute you specify the files you want to
  1415. have included by using patterns. The <i>exclude</i> or <i>excludesfile</i> attribute is used to specify
  1416. the files you want to have excluded. This is also done with patterns. And
  1417. finally with the <i>defaultexcludes</i> attribute, you can specify whether you
  1418. want to use default exclusions or not. See the section on <a
  1419. href="#directorybasedtasks">directory based tasks</a>, on how the
  1420. inclusion/exclusion of files works, and how to write patterns. The patterns are
  1421. relative to the <i>basedir</i> directory.</p>
  1422. <p>The <i>includes</i>, <i>excludes</i> and <i>defaultexcludes</i> attributes
  1423. replace the <i>items</i> and <i>ignore</i> attributes. The following explains
  1424. how the deprecated <i>items</i> and <i>ignore</i> attribute behave.</p>
  1425. <p>When &quot;*&quot; is used for <i>items</i>, all files in the basedir, and
  1426. its subdirectories, will be jarred. Otherwise all the files and directories
  1427. mentioned in the items list will jarred. When a directory is specified, then all
  1428. files within it are also jarred.</p>
  1429. <p>With the <i>ignore</i> attribute, you can specify files or directories to
  1430. ignore. These files will not be jarred. The items in the <i>ignore</i> attribute
  1431. override the items in the <i>items</i> attribute. The names specified in the <i>ignore</i>
  1432. attribute are just names, they do not contain any path information!</p>
  1433. <h3>Parameters</h3>
  1434. <table border="1" cellpadding="2" cellspacing="0">
  1435. <tr>
  1436. <td valign="top"><b>Attribute</b></td>
  1437. <td valign="top"><b>Description</b></td>
  1438. <td align="center" valign="top"><b>Required</b></td>
  1439. </tr>
  1440. <tr>
  1441. <td valign="top">jarfile</td>
  1442. <td valign="top">the jar-file to create.</td>
  1443. <td valign="top" align="center">Yes</td>
  1444. </tr>
  1445. <tr>
  1446. <td valign="top">basedir</td>
  1447. <td valign="top">the directory from which to jar the files.</td>
  1448. <td valign="top" align="center">Yes</td>
  1449. </tr>
  1450. <tr>
  1451. <td valign="top">compress</td>
  1452. <td valign="top">Not only store data but also compress them, defaults to true</td>
  1453. <td align="center" valign="top">No</td>
  1454. </tr>
  1455. <tr>
  1456. <td valign="top">items</td>
  1457. <td valign="top">a comma separated list of the files/directories to jar. All
  1458. files are included when omitted. (<b>deprecated</b>, use <i>includes</i>
  1459. instead).</td>
  1460. <td valign="top" align="center">No</td>
  1461. </tr>
  1462. <tr>
  1463. <td valign="top">ignore</td>
  1464. <td valign="top">comma separated list of filenames/directorynames to exclude
  1465. from the jar. No files (except default excludes) are excluded when
  1466. omitted. (<b>deprecated</b>, use <i>excludes</i> instead).</td>
  1467. <td valign="top" align="center">No</td>
  1468. </tr>
  1469. <tr>
  1470. <td valign="top">includes</td>
  1471. <td valign="top">comma separated list of patterns of files that must be
  1472. included. All files are included when omitted.</td>
  1473. <td valign="top" align="center">No</td>
  1474. </tr>
  1475. <tr>
  1476. <td valign="top">includesfile</td>
  1477. <td valign="top">the name of a file. Each line of this file is
  1478. taken to be an include pattern</td>
  1479. <td valign="top" align="center">No</td>
  1480. </tr>
  1481. <tr>
  1482. <td valign="top">excludes</td>
  1483. <td valign="top">comma separated list of patterns of files that must be
  1484. excluded. No files (except default excludes) are excluded when omitted.</td>
  1485. <td valign="top" align="center">No</td>
  1486. </tr>
  1487. <tr>
  1488. <td valign="top">excludesfile</td>
  1489. <td valign="top">the name of a file. Each line of this file is
  1490. taken to be an exclude pattern</td>
  1491. <td valign="top" align="center">No</td>
  1492. </tr>
  1493. <tr>
  1494. <td valign="top">defaultexcludes</td>
  1495. <td valign="top">indicates whether default excludes should be used or not
  1496. (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when omitted.</td>
  1497. <td valign="top" align="center">No</td>
  1498. </tr>
  1499. <tr>
  1500. <td valign="top">manifest</td>
  1501. <td valign="top">the manifest file to use.</td>
  1502. <td valign="top" align="center">No</td>
  1503. </tr>
  1504. </table>
  1505. <h3>Examples</h3>
  1506. <pre> &lt;jar jarfile=&quot;${dist}/lib/app.jar&quot; basedir=&quot;${build}/classes&quot; /&gt;</pre>
  1507. <p>jars all files in the <code>${build}/classes</code> directory in a file
  1508. called <code>app.jar</code> in the <code>${dist}/lib</code> directory.</p>
  1509. <pre> &lt;jar jarfile=&quot;${dist}/lib/app.jar&quot;
  1510. basedir=&quot;${build}/classes&quot;
  1511. excludes=&quot;**/Test.class&quot;
  1512. /&gt;</pre>
  1513. <p>jars all files in the <code>${build}/classes</code> directory in a file
  1514. called <code>app.jar</code> in the <code>${dist}/lib</code> directory. Files
  1515. with the name <code>Test.class</code> are excluded.</p>
  1516. <pre> &lt;jar jarfile=&quot;${dist}/lib/app.jar&quot;
  1517. basedir=&quot;${build}/classes&quot;
  1518. includes=&quot;mypackage/test/**&quot;
  1519. excludes=&quot;**/Test.class&quot;
  1520. /&gt;</pre>
  1521. <p>jars all files in the <code>${build}/classes</code> directory in a file
  1522. called <code>app.jar</code> in the <code>${dist}/lib</code> directory. Only
  1523. files under the directory <code>mypackage/test</code> are used, and files with
  1524. the name <code>Test.class</code> are excluded.</p>
  1525. <h3>Deprecated examples</h3>
  1526. <pre> &lt;jar jarfile=&quot;${dist}/lib/app.jar&quot; basedir=&quot;${build}/classes&quot; items=&quot;*&quot; /&gt;</pre>
  1527. <p>jars all files in the <code>${build}/classes</code> directory in a file
  1528. called <code>app.jar</code> in the <code>${dist}/lib</code> directory.</p>
  1529. <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>
  1530. <p>jars all files in the <code>${build}/classes</code> directory in a file
  1531. called <code>app.jar</code> in the <code>${dist}/lib</code> directory.
  1532. Files/directories with the name <code>Test.class</code> are excluded.</p>
  1533. <hr>
  1534. <h2><a name="java">Java</a></h2>
  1535. <h3>Description</h3>
  1536. <p>Executes a Java class within the running (Ant) VM or forks another VM if
  1537. specified.</p>
  1538. <p>Be careful that the executed class doesn't call System.exit(), because it
  1539. will terminate the VM and thus Ant. In case this happens, it's highly suggested
  1540. that you set the fork attribute so that System.exit() stops the other VM and not
  1541. the one that is currently running Ant.</p>
  1542. <h3>Parameters</h3>
  1543. <table border="1" cellpadding="2" cellspacing="0">
  1544. <tr>
  1545. <td valign="top"><b>Attribute</b></td>
  1546. <td valign="top"><b>Description</b></td>
  1547. <td align="center" valign="top"><b>Required</b></td>
  1548. </tr>
  1549. <tr>
  1550. <td valign="top">classname</td>
  1551. <td valign="top">the Java class to execute.</td>
  1552. <td align="center" valign="top">Yes</td>
  1553. </tr>
  1554. <tr>
  1555. <td valign="top">args</td>
  1556. <td valign="top">the arguments for the class that is executed.</td>
  1557. <td align="center" valign="top">No</td>
  1558. </tr>
  1559. <tr>
  1560. <td valign="top">classpath</td>
  1561. <td valign="top">the classpath to use.</td>
  1562. <td align="center" valign="top">No</td>
  1563. </tr>
  1564. <tr>
  1565. <td valign="top">fork</td>
  1566. <td valign="top">if enabled triggers the class execution in another VM
  1567. (disabled by default)</td>
  1568. <td align="center" valign="top">No</td>
  1569. </tr>
  1570. <tr>
  1571. <td valign="top">jvm</td>
  1572. <td valign="top">the command used to invoke the Java Virtual Machine,
  1573. default is 'java'. The command is resolved by java.lang.Runtime.exec().
  1574. Ignored if fork is disabled.
  1575. </td>
  1576. <td align="center" valign="top">No</td>
  1577. </tr>
  1578. <tr>
  1579. <td valign="top">jvmargs</td>
  1580. <td valign="top">the arguments to pass to the forked VM (ignored if fork is
  1581. disabled)</td>
  1582. <td align="center" valign="top">No</td>
  1583. </tr>
  1584. <tr>
  1585. <td valign="top">failonerror</td>
  1586. <td valign="top">Stop the buildprocess if the command exits with a
  1587. returncode other than 0. Only available if fork is true.</td>
  1588. <td align="center" valign="top">No</td>
  1589. </tr>
  1590. </table>
  1591. <h3>Examples</h3>
  1592. <pre> &lt;java classname=&quot;test.Main&quot; /&gt;</pre>
  1593. <pre> &lt;java classname=&quot;test.Main&quot; args=&quot;-h&quot; /&gt;</pre>
  1594. <pre> &lt;java classname=&quot;test.Main&quot;
  1595. args=&quot;-h&quot;
  1596. fork=&quot;yes&quot;
  1597. jvmargs=&quot;-Xrunhprof:cpu=samples,file=log.txt,depth=3&quot;
  1598. /&gt;</pre>
  1599. <hr>
  1600. <h2><a name="javac">Javac</a></h2>
  1601. <h3>Description</h3>
  1602. <p>Compiles a source tree within the running (Ant) VM.</p>
  1603. <p>The source and destination directory will be recursively scanned for Java
  1604. source files to compile. Only Java files that have no corresponding class file
  1605. or where the class file is older than the java file will be compiled.</p>
  1606. <p>Files in the source tree, that are no java files, are copied to the
  1607. destination directory, allowing support files to be located properly in the
  1608. classpath.</p>
  1609. <p>The directory structure of the source tree should follow the package
  1610. hierarchy.</p>
  1611. <p>It is possible to refine the set of files that are being compiled/copied.
  1612. This can be done with the <i>includes</i>, <i>includesfile</i>, <i>excludes</i>, <i>excludesfile</i> and <i>defaultexcludes</i>
  1613. attributes. With the <i>includes</i> or <i>includesfile</i> attribute you specify the files you want to
  1614. have included by using patterns. The <i>exclude</i> or <i>excludesfile</i> attribute is used to specify
  1615. the files you want to have excluded. This is also done with patterns. And
  1616. finally with the <i>defaultexcludes</i> attribute, you can specify whether you
  1617. want to use default exclusions or not. See the section on <a
  1618. href="#directorybasedtasks">directory based tasks</a>, on how the
  1619. inclusion/exclusion of files works, and how to write patterns. The patterns are
  1620. relative to the <i>srcdir</i> directory.</p>
  1621. <p>It is possible to use different compilers. This can be selected with the
  1622. &quot;build.compiler&quot; property. There are three choices:</p>
  1623. <ul>
  1624. <li>classic (the standard compiler of JDK 1.1/1.2)</li>
  1625. <li>modern (the new compiler of JDK 1.3)</li>
  1626. <li>jikes (the <a
  1627. href="http://oss.software.ibm.com/developerworks/opensource/jikes/project">Jikes</a>
  1628. compiler)</li>
  1629. </ul>
  1630. <p>For JDK 1.1/1.2 is classic the default. For JDK 1.3 is modern the default.</p>
  1631. <h3>Parameters</h3>
  1632. <table border="1" cellpadding="2" cellspacing="0">
  1633. <tr>
  1634. <td valign="top"><b>Attribute</b></td>
  1635. <td valign="top"><b>Description</b></td>
  1636. <td align="center" valign="top"><b>Required</b></td>
  1637. </tr>
  1638. <tr>
  1639. <td valign="top">srcdir</td>
  1640. <td valign="top">location of the java files.</td>
  1641. <td align="center" valign="top">Yes, unless nested <code>&lt;src&gt;</code> elements are present.</td>
  1642. </tr>
  1643. <tr>
  1644. <td valign="top">destdir</td>
  1645. <td valign="top">location where to store the class files.</td>
  1646. <td align="center" valign="top">Yes</td>
  1647. </tr>
  1648. <tr>
  1649. <td valign="top">includes</td>
  1650. <td valign="top">comma separated list of patterns of files that must be
  1651. included. All files are included when omitted.</td>
  1652. <td valign="top" align="center">No</td>
  1653. </tr>
  1654. <tr>
  1655. <td valign="top">includesfile</td>
  1656. <td valign="top">the name of a file. Each line of this file is
  1657. taken to be an include pattern</td>
  1658. <td valign="top" align="center">No</td>
  1659. </tr>
  1660. <tr>
  1661. <td valign="top">excludes</td>
  1662. <td valign="top">comma separated list of patterns of files that must be
  1663. excluded. No files (except default excludes) are excluded when omitted.</td>
  1664. <td valign="top" align="center">No</td>
  1665. </tr>
  1666. <tr>
  1667. <td valign="top">excludesfile</td>
  1668. <td valign="top">the name of a file. Each line of this file is
  1669. taken to be an exclude pattern</td>
  1670. <td valign="top" align="center">No</td>
  1671. </tr>
  1672. <tr>
  1673. <td valign="top">defaultexcludes</td>
  1674. <td valign="top">indicates whether default excludes should be used or not
  1675. (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when omitted.</td>
  1676. <td valign="top" align="center">No</td>
  1677. </tr>
  1678. <tr>
  1679. <td valign="top">classpath</td>
  1680. <td valign="top">the classpath to use.</td>
  1681. <td align="center" valign="top">No</td>
  1682. </tr>
  1683. <tr>
  1684. <td valign="top">bootclasspath</td>
  1685. <td valign="top">location of bootstrap class files.</td>
  1686. <td align="center" valign="top">No</td>
  1687. </tr>
  1688. <tr>
  1689. <td valign="top">extdirs</td>
  1690. <td valign="top">location of installed extensions.</td>
  1691. <td align="center" valign="top">No</td>
  1692. </tr>
  1693. <tr>
  1694. <td valign="top">debug</td>
  1695. <td valign="top">indicates whether there should be compiled with debug
  1696. information (&quot;on&quot;).</td>
  1697. <td align="center" valign="top">No</td>
  1698. </tr>
  1699. <tr>
  1700. <td valign="top">optimize</td>
  1701. <td valign="top">indicates whether there should be compiled with
  1702. optimization (&quot;on&quot;).</td>
  1703. <td align="center" valign="top">No</td>
  1704. </tr>
  1705. <tr>
  1706. <td valign="top">deprecation</td>
  1707. <td valign="top">indicates whether there should be compiled with deprecation
  1708. information (&quot;on&quot;).</td>
  1709. <td align="center" valign="top">No</td>
  1710. </tr>
  1711. <tr>
  1712. <td valign="top">filtering</td>
  1713. <td valign="top">indicates whether token filtering should take place</td>
  1714. <td valign="top" align="center">No</td>
  1715. </tr>
  1716. <tr>
  1717. <td valign="top">target</td>
  1718. <td valign="top">Generate class files for specific VM version, e.g. "1.1" or "1.2".</td>
  1719. <td align="center" valign="top">No</td>
  1720. </tr>
  1721. </table>
  1722. <h3>Parameters specified as nested elements</h3>
  1723. Being a directory based task, Javac supports the <code>&lt;include&gt;</code> and
  1724. <code>&lt;exclude&gt;</code> nested elements common to a number of Ant tasks. Javac also supports a
  1725. nested <code>&lt;src&gt;</code> element. This is used to specify multiple source paths.
  1726. Multiple <code>src</code> elements may be present and each specifies a source path which will be
  1727. searched by Javac for classes to compile.
  1728. <h4>src</h4>
  1729. Define a source path to be search for source files.
  1730. <H4>Parameters</h4>
  1731. <table width="60%" border="1" cellpadding="2" cellspacing="0">
  1732. <tr>
  1733. <td valign="top"><b>Attribute</b></td>
  1734. <td valign="top"><b>Description</b></td>
  1735. <td align="center" valign="top"><b>Required</b></td>
  1736. </tr>
  1737. <tr>
  1738. <td valign="top">src</td>
  1739. <td valign="top">A source path. It may contain multiple elements separated with either a ';' or a ':'</td>
  1740. <td align="center" valign="top">Yes</td>
  1741. </tr>
  1742. </table>
  1743. <h3>Examples</h3>
  1744. <pre> &lt;javac srcdir=&quot;${src}&quot;
  1745. destdir=&quot;${build}&quot;
  1746. classpath=&quot;xyz.jar&quot;
  1747. debug=&quot;on&quot;
  1748. /&gt;</pre>
  1749. <p>compiles all .java files under the directory <code>${src}</code>, and stores
  1750. the .class files in the directory <code>${build}</code>. It also copies the non-java
  1751. files from the tree under <code>${src}</code> to the tree under <code>${build}</code>.
  1752. The classpath used contains <code>xyz.jar</code>, and debug information is on.</p>
  1753. <pre> &lt;javac srcdir=&quot;${src}&quot;
  1754. destdir=&quot;${build}&quot;
  1755. includes=&quot;mypackage/p1/**,mypackage/p2/**&quot;
  1756. excludes=&quot;mypackage/p1/testpackage/**&quot;
  1757. classpath=&quot;xyz.jar&quot;
  1758. debug=&quot;on&quot;
  1759. /&gt;</pre>
  1760. <p>compiles .java files under the directory <code>${src}</code>, and stores the
  1761. .class files in the directory <code>${build}</code>. It also copies the non-java
  1762. files from the tree under <code>${src}</code> to the tree under <code>${build}</code>.
  1763. The classpath used contains <code>xyz.jar</code>, and debug information is on.
  1764. Only files under <code>mypackage/p1</code> and <code>mypackage/p2</code> are
  1765. used. Files in the <code>mypackage/p1/testpackage</code> directory are excluded
  1766. form compilation and copy.</p>
  1767. <pre> &lt;javac srcdir=&quot;${src}:${src2}&quot;
  1768. destdir=&quot;${build}&quot;
  1769. includes=&quot;mypackage/p1/**,mypackage/p2/**&quot;
  1770. excludes=&quot;mypackage/p1/testpackage/**&quot;
  1771. classpath=&quot;xyz.jar&quot;
  1772. debug=&quot;on&quot;
  1773. /&gt;</pre>
  1774. <p>is the same as the previous example with the addition of a second source path, defined by
  1775. the propery <code>src2</code>. This can also be represented using nested elements as follows
  1776. <pre> &lt;javac destdir=&quot;${build}&quot;
  1777. classpath=&quot;xyz.jar&quot;
  1778. debug=&quot;on&quot;&gt;
  1779. &lt;src path=&quot;${src}&quot; /&gt;
  1780. &lt;src path=&quot;${src2}&quot; /&gt;
  1781. &lt;include name=&quot;mypackage/p1/**,mypackage/p2/**&quot; /&gt;
  1782. &lt;exclude name=&quot;mypackage/p1/testpackage/**&quot; /&gt;
  1783. &lt;/javac&gt;</pre>
  1784. <hr>
  1785. <h2><a name="javadoc">Javadoc/Javadoc2</a></h2>
  1786. <h3>Description</h3>
  1787. <p>Generates code documentation using the javadoc tool.</p>
  1788. <p>The source directory will be recursively scanned for Java source files to process
  1789. but only those matching the inclusion rules will be passed to the javadoc tool. This
  1790. allows wildcards to be used to choose between package names, reducing verbosity
  1791. and management costs over time. This task, however, has no notion of
  1792. &quot;changed&quot; files, unlike the <a href="#javac">javac</a> task. This means
  1793. all packages will be processed each time this task is run. In general, however,
  1794. this task is used much less frequently.</p>
  1795. <p>This task works seamlessly between different javadoc versions (1.1 and 1.2),
  1796. with the obvious restriction that the 1.2 attributes will be ignored if run in a
  1797. 1.1 VM.</p>
  1798. <p>NOTE: since javadoc calls System.exit(), javadoc cannot be run inside the
  1799. same VM as ant without breaking functionality. For this reason, this task
  1800. always forks the VM. This overhead is not significant since javadoc is normally a heavy
  1801. application and will be called infrequently.</p>
  1802. <p>NOTE: the packagelist attribute allows you to specify the list of packages to
  1803. document outside of the Ant file. It's a much better practice to include everything
  1804. inside the build.xml file. This option was added in order to make it easier to
  1805. migrate from regular makefiles, where you would use this option of javadoc.
  1806. The packages listed in packagelist are not checked, so the task performs even
  1807. if some packages are missing or broken. Use this option if you wish to convert from
  1808. an existing makefile. Once things are running you should then switch to the regular
  1809. notation.
  1810. <p>DEPRECATION: the javadoc2 task simply points to the javadoc task and it's
  1811. there for back compatibility reasons. Since this task will be removed in future
  1812. versions, you are strongly encouraged to use <a href="#javadoc">javadoc</a>
  1813. instead.</p>
  1814. <h3>Parameters</h3>
  1815. <table border="1" cellpadding="2" cellspacing="0">
  1816. <tr>
  1817. <td valign="top"><b>Attribute</b></td>
  1818. <td valign="top"><b>Description</b></td>
  1819. <td align="center" valign="top"><b>Availability</b></td>
  1820. <td align="center" valign="top"><b>Required</b></td>
  1821. </tr>
  1822. <tr>
  1823. <td valign="top">sourcepath</td>
  1824. <td valign="top">Specify where to find source files</td>
  1825. <td align="center" valign="top">all</td>
  1826. <td align="center" valign="top">Yes</td>
  1827. </tr>
  1828. <tr>
  1829. <td valign="top">destdir</td>
  1830. <td valign="top">Destination directory for output files</td>
  1831. <td align="center" valign="top">all</td>
  1832. <td align="center" valign="top">Yes</td>
  1833. </tr>
  1834. <tr>
  1835. <td valign="top">maxmemory</td>
  1836. <td valign="top">Max amount of memory to allocate to the javadoc VM</td>
  1837. <td align="center" valign="top">all</td>
  1838. <td align="center" valign="top">No</td>
  1839. </tr>
  1840. <tr>
  1841. <td valign="top">sourcefiles</td>
  1842. <td valign="top">Space separated list of source files</td>
  1843. <td align="center" valign="top">all</td>
  1844. <td align="center" valign="middle" rowspan="2">at least one of the two</td>
  1845. </tr>
  1846. <tr>
  1847. <td valign="top">packagenames</td>
  1848. <td valign="top">Space separated list of package files (with terminating
  1849. wildcard)</td>
  1850. <td align="center" valign="top">all</td>
  1851. </tr>
  1852. <tr>
  1853. <td valign="top">packageList</td>
  1854. <td valign="top">The name of a file containing the packages to process</td>
  1855. <td align="center" valign="top">all</td>
  1856. <td align="center" valign="top">No</td>
  1857. </tr>
  1858. <tr>
  1859. <td valign="top">classpath</td>
  1860. <td valign="top">Specify where to find user class files</td>
  1861. <td align="center" valign="top">all</td>
  1862. <td align="center" valign="top">No</td>
  1863. </tr>
  1864. <tr>
  1865. <td valign="top">Bootclasspath</td>
  1866. <td valign="top">Override location of class files loaded by the bootstrap
  1867. class loader</td>
  1868. <td align="center" valign="top">1.2</td>
  1869. <td align="center" valign="top">No</td>
  1870. </tr>
  1871. <tr>
  1872. <td valign="top">Extdirs</td>
  1873. <td valign="top">Override location of installed extensions</td>
  1874. <td align="center" valign="top">1.2</td>
  1875. <td align="center" valign="top">No</td>
  1876. </tr>
  1877. <tr>
  1878. <td valign="top">Overview</td>
  1879. <td valign="top">Read overview documentation from HTML file</td>
  1880. <td align="center" valign="top">1.2</td>
  1881. <td align="center" valign="top">No</td>
  1882. </tr>
  1883. <tr>
  1884. <td valign="top">Public</td>
  1885. <td valign="top">Show only public classes and members</td>
  1886. <td align="center" valign="top">all</td>
  1887. <td align="center" valign="top">No</td>
  1888. </tr>
  1889. <tr>
  1890. <td valign="top">Protected</td>
  1891. <td valign="top">Show protected/public classes and members (default)</td>
  1892. <td align="center" valign="top">all</td>
  1893. <td align="center" valign="top">No</td>
  1894. </tr>
  1895. <tr>
  1896. <td valign="top">Package</td>
  1897. <td valign="top">Show package/protected/public classes and members</td>
  1898. <td align="center" valign="top">all</td>
  1899. <td align="center" valign="top">No</td>
  1900. </tr>
  1901. <tr>
  1902. <td valign="top">Private</td>
  1903. <td valign="top">Show all classes and members</td>
  1904. <td align="center" valign="top">all</td>
  1905. <td align="center" valign="top">No</td>
  1906. </tr>
  1907. <tr>
  1908. <td valign="top">Old</td>
  1909. <td valign="top">Generate output using JDK 1.1 emulating doclet</td>
  1910. <td align="center" valign="top">1.2</td>
  1911. <td align="center" valign="top">No</td>
  1912. </tr>
  1913. <tr>
  1914. <td valign="top">Verbose</td>
  1915. <td valign="top">Output messages about what Javadoc is doing</td>
  1916. <td align="center" valign="top">1.2</td>
  1917. <td align="center" valign="top">No</td>
  1918. </tr>
  1919. <tr>
  1920. <td valign="top">Locale</td>
  1921. <td valign="top">Locale to be used, e.g. en_US or en_US_WIN</td>
  1922. <td align="center" valign="top">1.2</td>
  1923. <td align="center" valign="top">No</td>
  1924. </tr>
  1925. <tr>
  1926. <td valign="top">Encoding</td>
  1927. <td valign="top">Source file encoding name</td>
  1928. <td align="center" valign="top">all</td>
  1929. <td align="center" valign="top">No</td>
  1930. </tr>
  1931. <tr>
  1932. <td valign="top">Version</td>
  1933. <td valign="top">Include @version paragraphs</td>
  1934. <td align="center" valign="top">all</td>
  1935. <td align="center" valign="top">No</td>
  1936. </tr>
  1937. <tr>
  1938. <td valign="top">Use</td>
  1939. <td valign="top">Create class and package usage pages</td>
  1940. <td align="center" valign="top">1.2</td>
  1941. <td align="center" valign="top">No</td>
  1942. </tr>
  1943. <tr>
  1944. <td valign="top">Author</td>
  1945. <td valign="top">Include @author paragraphs</td>
  1946. <td align="center" valign="top">all</td>
  1947. <td align="center" valign="top">No</td>
  1948. </tr>
  1949. <tr>
  1950. <td valign="top">Splitindex</td>
  1951. <td valign="top">Split index into one file per letter</td>
  1952. <td align="center" valign="top">1.2</td>
  1953. <td align="center" valign="top">No</td>
  1954. </tr>
  1955. <tr>
  1956. <td valign="top">Windowtitle</td>
  1957. <td valign="top">Browser window title for the documenation (text)</td>
  1958. <td align="center" valign="top">1.2</td>
  1959. <td align="center" valign="top">No</td>
  1960. </tr>
  1961. <tr>
  1962. <td valign="top">Doctitle</td>
  1963. <td valign="top">Include title for the package index(first) page (html-code)</td>
  1964. <td align="center" valign="top">1.2</td>
  1965. <td align="center" valign="top">No</td>
  1966. </tr>
  1967. <tr>
  1968. <td valign="top">Header</td>
  1969. <td valign="top">Include header text for each page (html-code)</td>
  1970. <td align="center" valign="top">1.2</td>
  1971. <td align="center" valign="top">No</td>
  1972. </tr>
  1973. <tr>
  1974. <td valign="top">Footer</td>
  1975. <td valign="top">Include footer text for each page (html-code)</td>
  1976. <td align="center" valign="top">1.2</td>
  1977. <td align="center" valign="top">No</td>
  1978. </tr>
  1979. <tr>
  1980. <td valign="top">bottom</td>
  1981. <td valign="top">Include bottom text for each page (html-code)</td>
  1982. <td align="center" valign="top">1.2</td>
  1983. <td align="center" valign="top">No</td>
  1984. </tr>
  1985. <tr>
  1986. <td valign="top">link</td>
  1987. <td valign="top">Create links to javadoc output at the given URL</td>
  1988. <td align="center" valign="top">1.2</td>
  1989. <td align="center" valign="top">No</td>
  1990. </tr>
  1991. <tr>
  1992. <td valign="top">linkoffline</td>
  1993. <td valign="top">Link to docs at &lt;url&gt; using package list at
  1994. &lt;url2&gt;</td>
  1995. <td align="center" valign="top">1.2</td>
  1996. <td align="center" valign="top">No</td>
  1997. </tr>
  1998. <tr>
  1999. <td valign="top">group</td>
  2000. <td valign="top">Group specified packages together in overview page</td>
  2001. <td align="center" valign="top">1.2</td>
  2002. <td align="center" valign="top">No</td>
  2003. </tr>
  2004. <tr>
  2005. <td valign="top">nodeprecated</td>
  2006. <td valign="top">Do not include @deprecated information</td>
  2007. <td align="center" valign="top">all</td>
  2008. <td align="center" valign="top">No</td>
  2009. </tr>
  2010. <tr>
  2011. <td valign="top">nodeprecatedlist</td>
  2012. <td valign="top">Do not generate deprecated list</td>
  2013. <td align="center" valign="top">1.2</td>
  2014. <td align="center" valign="top">No</td>
  2015. </tr>
  2016. <tr>
  2017. <td valign="top">notree</td>
  2018. <td valign="top">Do not generate class hierarchy</td>
  2019. <td align="center" valign="top">all</td>
  2020. <td align="center" valign="top">No</td>
  2021. </tr>
  2022. <tr>
  2023. <td valign="top">noindex</td>
  2024. <td valign="top">Do not generate index</td>
  2025. <td align="center" valign="top">all</td>
  2026. <td align="center" valign="top">No</td>
  2027. </tr>
  2028. <tr>
  2029. <td valign="top">nohelp</td>
  2030. <td valign="top">Do not generate help link</td>
  2031. <td align="center" valign="top">1.2</td>
  2032. <td align="center" valign="top">No</td>
  2033. </tr>
  2034. <tr>
  2035. <td valign="top">nonavbar</td>
  2036. <td valign="top">Do not generate navigation bar</td>
  2037. <td align="center" valign="top">1.2</td>
  2038. <td align="center" valign="top">No</td>
  2039. </tr>
  2040. <tr>
  2041. <td valign="top">serialwarn</td>
  2042. <td valign="top">FUTURE: Generate warning about @serial tag</td>
  2043. <td align="center" valign="top">1.2</td>
  2044. <td align="center" valign="top">No</td>
  2045. </tr>
  2046. <tr>
  2047. <td valign="top">helpfile</td>
  2048. <td valign="top">FUTURE: Specifies the HTML help file to use</td>
  2049. <td align="center" valign="top">1.2</td>
  2050. <td align="center" valign="top">No</td>
  2051. </tr>
  2052. <tr>
  2053. <td valign="top">stylesheetfile</td>
  2054. <td valign="top">Specifies the CSS stylesheet to use</td>
  2055. <td align="center" valign="top">1.2</td>
  2056. <td align="center" valign="top">No</td>
  2057. </tr>
  2058. <tr>
  2059. <td valign="top">charset</td>
  2060. <td valign="top">FUTURE: Charset for cross-platform viewing of generated
  2061. documentation</td>
  2062. <td align="center" valign="top">1.2</td>
  2063. <td align="center" valign="top">No</td>
  2064. </tr>
  2065. <tr>
  2066. <td valign="top">docencoding</td>
  2067. <td valign="top">Output file encoding name</td>
  2068. <td align="center" valign="top">1.1</td>
  2069. <td align="center" valign="top">No</td>
  2070. </tr>
  2071. <tr>
  2072. <td valign="top">doclet</td>
  2073. <td valign="top">Specifies the class file that starts the doclet used in generating the documentation.</td>
  2074. <td align="center" valign="top">1.2</td>
  2075. <td align="center" valign="top">No</td>
  2076. </tr>
  2077. <tr>
  2078. <td valign="top">docletpath</td>
  2079. <td valign="top">Specifies the path to the doclet class file that is specified with the -doclet option.</td>
  2080. <td align="center" valign="top">1.2</td>
  2081. <td align="center" valign="top">No</td>
  2082. </tr>
  2083. <tr>
  2084. <td valign="top">additionalparam</td>
  2085. <td valign="top">Lets you add additional parameters to the javadoc command line. Useful for doclets</td>
  2086. <td align="center" valign="top">1.2</td>
  2087. <td align="center" valign="top">No</td>
  2088. </tr>
  2089. <tr>
  2090. <td valign="top">failonerror</td>
  2091. <td valign="top">Stop the buildprocess if the command exits with a
  2092. returncode other than 0.</td>
  2093. <td align="center" valign="top">all</td>
  2094. <td align="center" valign="top">No</td>
  2095. </tr>
  2096. </table>
  2097. <h3>Parameters specified as nested elements</h3>
  2098. Two parameters of the Javadoc task may be specified as nested elements of the
  2099. Javadoc task element: link and group.
  2100. When present, there can be any number of each of these elements.
  2101. They perform the same role as the link, linkoffline and
  2102. group attributes. You can use either syntax (or both at once), but with the nested
  2103. elements you can easily specify multiple occurrences of the arguments.
  2104. <h4>link</h4>
  2105. Create link to javadoc output at the given URL
  2106. <h4>Parameters</h4>
  2107. <table width="60%" border="1" cellpadding="2" cellspacing="0">
  2108. <tr>
  2109. <td valign="top"><b>Attribute</b></td>
  2110. <td valign="top"><b>Description</b></td>
  2111. <td align="center" valign="top"><b>Required</b></td>
  2112. </tr>
  2113. <tr>
  2114. <td valign="top">href</td>
  2115. <td valign="top">The URL for the external documentation you wish to link to</td>
  2116. <td align="center" valign="top">Yes</td>
  2117. </tr>
  2118. <tr>
  2119. <td valign="top">offline</td>
  2120. <td valign="top">True if this link is not available online at the time of
  2121. generating the documentation</td>
  2122. <td align="center" valign="top">No</td>
  2123. </tr>
  2124. <tr>
  2125. <td valign="top">packagelistLoc</td>
  2126. <td valign="top">The location to the directory containing the package-list file for
  2127. the external documentation</td>
  2128. <td align="center" valign="top">Only if the offline attribute is true</td>
  2129. </tr>
  2130. </table>
  2131. <h4>groups</h4>
  2132. Separates packages on the overview page into whatever groups you specify,
  2133. one group per table.
  2134. <table width="60%" border="1" cellpadding="2" cellspacing="0">
  2135. <tr>
  2136. <td valign="top"><b>Attribute</b></td>
  2137. <td valign="top"><b>Description</b></td>
  2138. <td align="center" valign="top"><b>Required</b></td>
  2139. </tr>
  2140. <tr>
  2141. <td valign="top">title</td>
  2142. <td valign="top">Title of the group</td>
  2143. <td align="center" valign="top">Yes</td>
  2144. </tr>
  2145. <tr>
  2146. <td valign="top">packages</td>
  2147. <td valign="top">List of packages to include in that group</td>
  2148. <td align="center" valign="top">Yes</td>
  2149. </tr>
  2150. </table>
  2151. <h3>Example</h3>
  2152. <pre> &lt;javadoc packagenames=&quot;com.dummy.test.*&quot;
  2153. sourcepath=&quot;src&quot;
  2154. destdir=&quot;docs/api&quot;
  2155. author=&quot;true&quot;
  2156. version=&quot;true&quot;
  2157. use=&quot;true&quot;
  2158. windowtitle=&quot;Test API&quot;
  2159. doctitle=&quot;&lt;h1&gt;Test&lt;/h1&gt;&quot;
  2160. bottom=&quot;&lt;i&gt;Copyright &amp;#169; 2000 Dummy Corp. All Rights Reserved.&lt;/i&gt;&quot;&gt;
  2161. &lt;group title=&quot;Group 1 Packages&quot; packages=&quot;com.dummy.test.a*&quot;/&gt;
  2162. &lt;group title=&quot;Group 2 Packages&quot; packages=&quot;com.dummy.test.b*&quot;/&gt;
  2163. &lt;link offline=&quot;true&quot; href=&quot;http://java.sun.com/products/jdk/1.2/docs/api/&quot; packagelistLoc=&quot;C:\tmp&quot;/&gt;
  2164. &lt;link href=&quot;http://developer.java.sun.com/developer/products/xml/docs/api/&quot;/&gt;
  2165. &lt/javadoc&gt;</pre>
  2166. <hr>
  2167. <h2><a name="keysubst">KeySubst</a></h2>
  2168. <h3>Description</h3>
  2169. <p>Performs keyword substitution in the source file, and writes the result to
  2170. the destination file.</p>
  2171. <p>Keys in the source file are of the form ${keyname}. The <i>keys</i> attribute
  2172. contains key/value pairs. When a key is found in the <i>keys</i> attribute, then
  2173. &quot;${keyname}&quot; is replaced by the corresponding value.</p>
  2174. <p>The <i>keys</i> attribute is of the form
  2175. &quot;name1=value1*name2=value2*name3=value3&quot;. The '*' is called the
  2176. separator, which might we changed with the <i>sep</i> attribute.</p>
  2177. <p>Note: the source file and destination file may not be the same.</p>
  2178. <h3>Parameters</h3>
  2179. <table border="1" cellpadding="2" cellspacing="0">
  2180. <tr>
  2181. <td valign="top"><b>Attribute</b></td>
  2182. <td valign="top"><b>Description</b></td>
  2183. <td align="center" valign="top"><b>Required</b></td>
  2184. </tr>
  2185. <tr>
  2186. <td valign="top">src</td>
  2187. <td valign="top">the source file.</td>
  2188. <td align="center" valign="top">Yes</td>
  2189. </tr>
  2190. <tr>
  2191. <td valign="top">dest</td>
  2192. <td valign="top">the destination file.</td>
  2193. <td align="center" valign="top">Yes</td>
  2194. </tr>
  2195. <tr>
  2196. <td valign="top">sep</td>
  2197. <td valign="top">the separator for the name/value pairs.</td>
  2198. <td align="center" valign="top">No</td>
  2199. </tr>
  2200. <tr>
  2201. <td valign="top">keys</td>
  2202. <td valign="top">name/value pairs for replacement.</td>
  2203. <td align="center" valign="top">Yes</td>
  2204. </tr>
  2205. </table>
  2206. <h3>Examples</h3>
  2207. <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>
  2208. <hr>
  2209. <h2><a name="mkdir">Mkdir</a></h2>
  2210. <h3>Description</h3>
  2211. <p>Creates a directory. Also non-existent parent directories are created, when
  2212. necessary.</p>
  2213. <h3>Parameters</h3>
  2214. <table border="1" cellpadding="2" cellspacing="0">
  2215. <tr>
  2216. <td valign="top"><b>Attribute</b></td>
  2217. <td valign="top"><b>Description</b></td>
  2218. <td align="center" valign="top"><b>Required</b></td>
  2219. </tr>
  2220. <tr>
  2221. <td valign="top">dir</td>
  2222. <td valign="top">the directory to create.</td>
  2223. <td align="center" valign="top">Yes</td>
  2224. </tr>
  2225. </table>
  2226. <h3>Examples</h3>
  2227. <pre>&lt;mkdir dir=&quot;${dist}&quot; /&gt;</pre>
  2228. <p>creates a directory <code>${dist}</code>.</p>
  2229. <pre>&lt;mkdir dir=&quot;${dist}/lib&quot; /&gt;</pre>
  2230. <p>creates a directory <code>${dist}/lib</code>.</p>
  2231. <hr>
  2232. <h2><a name="patch">Patch</a></h2>
  2233. <h3>Description</h3>
  2234. <p>Applies a diff file to originals.
  2235. <h3>Parameters</h3>
  2236. <table border="1" cellpadding="2" cellspacing="0">
  2237. <tr>
  2238. <td valign="top"><b>Attribute</b></td>
  2239. <td valign="top"><b>Description</b></td>
  2240. <td align="center" valign="top"><b>Required</b></td>
  2241. </tr>
  2242. <tr>
  2243. <td valign="top">dir</td>
  2244. <td valign="top">the directory in which the command should be executed.</td>
  2245. <td align="center" valign="top">Yes</td>
  2246. </tr>
  2247. <tr>
  2248. <td valign="top">os</td>
  2249. <td valign="top">list of Operating Systems on which the command may be
  2250. executed.</td>
  2251. <td align="center" valign="top">No</td>
  2252. </tr>
  2253. <tr>
  2254. <td valign="top">output</td>
  2255. <td valign="top">the file to which the output of the patch command
  2256. should be redirected.</td>
  2257. <td align="center" valign="top">No</td>
  2258. </tr>
  2259. <tr>
  2260. <td valign="top">patchfile</td>
  2261. <td valign="top">the file that includes the diff output</td>
  2262. <td align="center" valign="top">Yes</td>
  2263. </tr>
  2264. <tr>
  2265. <td valign="top">originalfile</td>
  2266. <td valign="top">the file to patch</td>
  2267. <td align="center" valign="top">No, tries to guess it from the diff
  2268. file</td>
  2269. </tr>
  2270. <tr>
  2271. <td valign="top">backups</td>
  2272. <td valign="top">Keep backups of the unpatched files</td>
  2273. <td align="center" valign="top">No</td>
  2274. </tr>
  2275. <tr>
  2276. <td valign="top">quiet</td>
  2277. <td valign="top">Work silently unless an error occurs</td>
  2278. <td align="center" valign="top">No</td>
  2279. </tr>
  2280. <tr>
  2281. <td valign="top">reverse</td>
  2282. <td valign="top">Assume patch was created with old and new files
  2283. swapped.</td>
  2284. <td align="center" valign="top">No</td>
  2285. </tr>
  2286. <tr>
  2287. <td valign="top">ignorewhitespace</td>
  2288. <td valign="top">Ignore whitespace differences.</td>
  2289. <td align="center" valign="top">No</td>
  2290. </tr>
  2291. <tr>
  2292. <td valign="top">strip</td>
  2293. <td valign="top">Strip the smallest prefix containing <i>num</i> leading
  2294. slashes from filenames.</td>
  2295. <td align="center" valign="top">No</td>
  2296. </tr>
  2297. <tr>
  2298. <td valign="top">failonerror</td>
  2299. <td valign="top">Stop the buildprocess if the command exits with a
  2300. returncode other than 0.</td>
  2301. <td align="center" valign="top">No</td>
  2302. </tr>
  2303. </table>
  2304. <h3>Examples</h3>
  2305. <pre> &lt;patch patchfile=&quot;module.1.0-1.1.patch&quot; /&gt;</pre>
  2306. <p>applies the diff included in <i>module.1.0-1.1.patch</i> to the
  2307. files in base directory guessing the filename(s) from the diff output.
  2308. <pre> &lt;patch patchfile=&quot;module.1.0-1.1.patch&quot; strip="1" /&gt;</pre>
  2309. <p>like above but one leading directory part will be removed. i.e. if
  2310. the diff output looked like
  2311. <pre>
  2312. --- a/mod1.0/A Mon Jun 5 17:28:41 2000
  2313. +++ a/mod1.1/A Mon Jun 5 17:28:49 2000
  2314. </pre>
  2315. the leading <i>a/</i> will be stripped.
  2316. <h2><a name="property">Property</a></h2>
  2317. <h3>Description</h3>
  2318. <p>Sets a property (by name and value), or set of properties (from file or
  2319. resource) in the project.</p>
  2320. <p>When a property was set by the user, or was a property in a parent project
  2321. (that started this project with the <a href="#ant">ant task</a>), then this
  2322. property cannot be set, and will be ignored. This means that properties set
  2323. outside the current project always override the properties of the current
  2324. project.</p>
  2325. <p>There are three ways to set properties:</p>
  2326. <ul>
  2327. <li>By supplying both the <i>name</i> and <i>value</i> attribute.</li>
  2328. <li>By setting the <i>file</i> attribute with the filename of the property
  2329. file to load. This property file has the format as defined by the file used
  2330. in the class java.util.Properties.</li>
  2331. <li>By setting the <i>resource</i> attribute with the resource name of the
  2332. property file to load. This property file has the format as defined by the
  2333. file used in the class java.util.Properties.</li>
  2334. </ul>
  2335. <p>Although combinations of the three ways are possible, only one should be used
  2336. at a time. Problems might occur with the order in which properties are set, for
  2337. instance.</p>
  2338. <p>The value part of the properties being set, might contain references to other
  2339. properties. These references are resolved at the time these properties are set.
  2340. This also holds for properties loaded from a property file.</p>
  2341. <h3>Parameters</h3>
  2342. <table border="1" cellpadding="2" cellspacing="0">
  2343. <tr>
  2344. <td valign="top"><b>Attribute</b></td>
  2345. <td valign="top"><b>Description</b></td>
  2346. <td align="center" valign="top"><b>Required</b></td>
  2347. </tr>
  2348. <tr>
  2349. <td valign="top">name</td>
  2350. <td valign="top">the name of the property to set.</td>
  2351. <td valign="top" align="center">Yes</td>
  2352. </tr>
  2353. <tr>
  2354. <td valign="top">value</td>
  2355. <td valign="top">the value of the property.</td>
  2356. <td valign="middle" align="center" rowspan="3">Yes</td>
  2357. </tr>
  2358. <tr>
  2359. <td valign="top">resource</td>
  2360. <td valign="top">the resource name of the property file.</td>
  2361. </tr>
  2362. <tr>
  2363. <td valign="top">file</td>
  2364. <td valign="top">the filename of the property file .</td>
  2365. </tr>
  2366. </table>
  2367. <h3>Examples</h3>
  2368. <pre> &lt;property name=&quot;foo.dist&quot; value=&quot;dist&quot; /&gt;</pre>
  2369. <p>sets the property <code>foo.dist</code> to the value &quot;dist&quot;.</p>
  2370. <pre> &lt;property file=&quot;foo.properties&quot; /&gt;</pre>
  2371. <p>reads a set of properties from a file called &quot;foo.properties&quot;.</p>
  2372. <pre> &lt;property resource=&quot;foo.properties&quot; /&gt;</pre>
  2373. <p>reads a set of properties from a resource called &quot;foo.properties&quot;.</p>
  2374. <p>Note that you can reference a global properties file for all of your Ant
  2375. builds using the following:
  2376. <pre> &lt;property file=&quot;${user.home}/.ant-global.properties&quot; /&gt;</pre>
  2377. <p>since the &quot;user.home&quot; property is defined by the Java virtual machine
  2378. to be your home directory. This technique is more appropriate for Unix than
  2379. Windows since the notion of a home directory doesn't exist on Windows. On the
  2380. JVM that I tested, the home directory on Windows is &quot;C:\&quot;. Different JVM
  2381. implementations may use other values for the home directory on Windows.
  2382. <hr>
  2383. <h2><a name="rename">Rename</a></h2>
  2384. <h3>Description</h3>
  2385. <p>Renames a given file.</p>
  2386. <h3>Parameters</h3>
  2387. <table border="1" cellpadding="2" cellspacing="0">
  2388. <tr>
  2389. <td valign="top"><b>Attribute</b></td>
  2390. <td valign="top"><b>Description</b></td>
  2391. <td align="center" valign="top"><b>Required</b></td>
  2392. </tr>
  2393. <tr>
  2394. <td valign="top">src</td>
  2395. <td valign="top">file to rename.</td>
  2396. <td valign="top" align="center">Yes</td>
  2397. </tr>
  2398. <tr>
  2399. <td valign="top">dest</td>
  2400. <td valign="top">new name of the file.</td>
  2401. <td valign="top" align="center">Yes</td>
  2402. </tr>
  2403. <tr>
  2404. <td valign="top">replace</td>
  2405. <td valign="top">Enable replacing of existing file (default: on).</td>
  2406. <td valign="top" align="center">No</td>
  2407. </tr>
  2408. </table>
  2409. <h3>Examples</h3>
  2410. <pre> &lt;rename src=&quot;foo.jar&quot; dest=&quot;${name}-${version}.jar&quot; /&gt;</pre>
  2411. <p>Renames the file <code>foo.jar</code> to <code>${name}-${version}.jar</code> (assuming <code>name</code>
  2412. and <code>version</code> being predefined properties). If a file named <code>${name}-${version}.jar</code>
  2413. already exists, it will be removed prior to renameing <code>foo.jar</code>.</p>
  2414. <hr>
  2415. <h2><a name="replace">Replace</a></h2>
  2416. <h3>Description</h3>
  2417. <p>Replace is a directory based task for replacing the occurrence of a given string with another string
  2418. in selected file.</p>
  2419. <h3>Parameters</h3>
  2420. <table border="1" cellpadding="2" cellspacing="0">
  2421. <tr>
  2422. <td valign="top"><b>Attribute</b></td>
  2423. <td valign="top"><b>Description</b></td>
  2424. <td align="center" valign="top"><b>Required</b></td>
  2425. </tr>
  2426. <tr>
  2427. <td valign="top">file</td>
  2428. <td valign="top">file for which the token should be replaced. If not present the dir attribute
  2429. must be specified</td>
  2430. <td valign="top" align="center">No</td>
  2431. </tr>
  2432. <tr>
  2433. <td valign="top">dir</td>
  2434. <td valign="top">The base directory to use when replacing a token in multiple files. If not present the file attribute
  2435. must be specified</td>
  2436. <td valign="top" align="center">No</td>
  2437. </tr>
  2438. <tr>
  2439. <td valign="top">token</td>
  2440. <td valign="top">the token which must be replaced.</td>
  2441. <td valign="top" align="center">Yes</td>
  2442. </tr>
  2443. <tr>
  2444. <td valign="top">value</td>
  2445. <td valign="top">the new value for the token. When omitted, an empty string
  2446. (&quot;&quot;) is used.</td>
  2447. <td valign="top" align="center">No</td>
  2448. </tr>
  2449. <tr>
  2450. <td valign="top">includes</td>
  2451. <td valign="top">comma separated list of patterns of files that must be
  2452. included. All files are included when omitted.</td>
  2453. <td valign="top" align="center">No</td>
  2454. </tr>
  2455. <tr>
  2456. <td valign="top">includesfile</td>
  2457. <td valign="top">the name of a file. Each line of this file is
  2458. taken to be an include pattern</td>
  2459. <td valign="top" align="center">No</td>
  2460. </tr>
  2461. <tr>
  2462. <td valign="top">excludes</td>
  2463. <td valign="top">comma separated list of patterns of files that must be
  2464. excluded. No files (except default excludes) are excluded when omitted.</td>
  2465. <td valign="top" align="center">No</td>
  2466. </tr>
  2467. <tr>
  2468. <td valign="top">excludesfile</td>
  2469. <td valign="top">the name of a file. Each line of this file is
  2470. taken to be an exclude pattern</td>
  2471. <td valign="top" align="center">No</td>
  2472. </tr>
  2473. <tr>
  2474. <td valign="top">defaultexcludes</td>
  2475. <td valign="top">indicates whether default excludes should be used or not
  2476. (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when omitted.</td>
  2477. <td valign="top" align="center">No</td>
  2478. </tr>
  2479. </table>
  2480. <h3>Examples</h3>
  2481. <pre> &lt;replace file=&quot;${src}/index.html&quot; token=&quot;@@@&quot; value=&quot;wombat&quot; /&gt;</pre>
  2482. <p>replaces occurrences of the string &quot;@@@&quot; with the string
  2483. &quot;wombat&quot;, in the file <code>${src}/index.html</code>.</p>
  2484. <hr>
  2485. <h2><a name="rmic">Rmic</a></h2>
  2486. <h3>Description</h3>
  2487. <p>Runs the rmic compiler for a certain class.</p>
  2488. <p>Rmic can be run on a single class (as specified with the classname
  2489. attribute) or a number of classes at once (all classes below base that
  2490. are neither _Stub nor _Skel classes).</p>
  2491. <p>It is possible to refine the set of files that are being rmiced. This can be
  2492. done with the <i>includes</i>, <i>includesfile</i>, <i>excludes</i>, <i>excludesfile</i> and <i>defaultexcludes</i>
  2493. attributes. With the <i>includes</i> or <i>includesfile</i> attribute you specify the files you want to
  2494. have included by using patterns. The <i>exclude</i> or <i>excludesfile</i> attribute is used to specify
  2495. the files you want to have excluded. This is also done with patterns. And
  2496. finally with the <i>defaultexcludes</i> attribute, you can specify whether you
  2497. want to use default exclusions or not. See the section on <a
  2498. href="#directorybasedtasks">directory based tasks</a>, on how the
  2499. inclusion/exclusion of files works, and how to write patterns. The patterns are
  2500. relative to the <i>base</i> directory.</p>
  2501. <h3>Parameters</h3>
  2502. <table border="1" cellpadding="2" cellspacing="0">
  2503. <tr>
  2504. <td valign="top"><b>Attribute</b></td>
  2505. <td valign="top"><b>Description</b></td>
  2506. <td align="center" valign="top"><b>Required</b></td>
  2507. </tr>
  2508. <tr>
  2509. <td valign="top">base</td>
  2510. <td valign="top">the location to store the compiled files.</td>
  2511. <td valign="top" align="center">Yes</td>
  2512. </tr>
  2513. <tr>
  2514. <td valign="top">classname</td>
  2515. <td valign="top">the class for which to run <code>rmic</code>.</td>
  2516. <td valign="top" align="center">No</td>
  2517. </tr>
  2518. <tr>
  2519. <td valign="top">filtering</td>
  2520. <td valign="top">indicates whether token filtering should take place</td>
  2521. <td valign="top" align="center">No</td>
  2522. </tr>
  2523. <tr>
  2524. <td valign="top">sourcebase</td>
  2525. <td valign="top">Pass the "-keepgenerated" flag to rmic and
  2526. move the generated source file to the base directory.</td>
  2527. <td align="center" valign="top">No</td>
  2528. </tr>
  2529. <tr>
  2530. <td valign="top">stubversion</td>
  2531. <td valign="top">Specify the JDK version for the generated stub code.
  2532. Specify "1.1" to pass the "-v1.1" option to rmic.</td>
  2533. <td align="center" valign="top">No</td>
  2534. </tr>
  2535. <tr>
  2536. <td valign="top">classpath</td>
  2537. <td valign="top">The classpath to use during compilation</td>
  2538. <td align="center" valign="top">No</td>
  2539. </tr>
  2540. <tr>
  2541. <td valign="top">includes</td>
  2542. <td valign="top">comma separated list of patterns of files that must be
  2543. included. All files are included when omitted.</td>
  2544. <td valign="top" align="center">No</td>
  2545. </tr>
  2546. <tr>
  2547. <td valign="top">includesfile</td>
  2548. <td valign="top">the name of a file. Each line of this file is
  2549. taken to be an include pattern</td>
  2550. <td valign="top" align="center">No</td>
  2551. </tr>
  2552. <tr>
  2553. <td valign="top">excludes</td>
  2554. <td valign="top">comma separated list of patterns of files that must be
  2555. excluded. No files (except default excludes) are excluded when omitted.</td>
  2556. <td valign="top" align="center">No</td>
  2557. </tr>
  2558. <tr>
  2559. <td valign="top">excludesfile</td>
  2560. <td valign="top">the name of a file. Each line of this file is
  2561. taken to be an exclude pattern</td>
  2562. <td valign="top" align="center">No</td>
  2563. </tr>
  2564. <tr>
  2565. <td valign="top">defaultexcludes</td>
  2566. <td valign="top">indicates whether default excludes should be used or not
  2567. (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when omitted.</td>
  2568. <td valign="top" align="center">No</td>
  2569. </tr>
  2570. <tr>
  2571. <td valign="top">verify</td>
  2572. <td valign="top">check that classes implement Remote before handing them
  2573. to rmic (default is false)</td>
  2574. <td align="center" valign="top">No</td>
  2575. </tr>
  2576. </table>
  2577. <h3>Examples</h3>
  2578. <pre> &lt;rmic classname=&quot;com.xyz.FooBar&quot; base=&quot;${build}/classes&quot; /&gt;</pre>
  2579. <p>runs the rmic compiler for the class <code>com.xyz.FooBar</code>. The
  2580. compiled files will be stored in the directory <code>${build}/classes</code>.</p>
  2581. <pre> &lt;rmic base=&quot;${build}/classes&quot; includes=&quot;**/Remote*.class&quot; /&gt;</pre>
  2582. <p>runs the rmic compiler for all classes with <code>.class</code>
  2583. files below <code>${build}/classes</code> whose classname starts with
  2584. <i>Remote</i>. The compiled files will be stored in the directory
  2585. <code>${build}/classes</code>.</p>
  2586. <hr>
  2587. <h2><a name="signjar">SignJar</a></h2>
  2588. <h3>Description</h3>
  2589. <p>Signs a jar or zip file with the javasign command line tool.</p>
  2590. <h3>Parameters</h3>
  2591. <table border="1" cellpadding="2" cellspacing="0">
  2592. <tr>
  2593. <td valign="top"><b>Attribute</b></td>
  2594. <td valign="top"><b>Description</b></td>
  2595. <td align="center" valign="top"><b>Required</b></td>
  2596. </tr>
  2597. <tr>
  2598. <td valign="top">jar</td>
  2599. <td valign="top">the jar file to sign</td>
  2600. <td valign="top" align="center">Yes.</td>
  2601. </tr>
  2602. <tr>
  2603. <td valign="top">alias</td>
  2604. <td valign="top">the alias to sign under</td>
  2605. <td valign="top" align="center">Yes.</td>
  2606. </tr>
  2607. <tr>
  2608. <td valign="top">storepass</td>
  2609. <td valign="top">password for keystore integrity.</td>
  2610. <td valign="top" align="center">Yes.</td>
  2611. </tr>
  2612. <tr>
  2613. <td valign="top">keystore</td>
  2614. <td valign="top">keystore location</td>
  2615. <td valign="top" align="center">No</td>
  2616. </tr>
  2617. <tr>
  2618. <td valign="top">storetype</td>
  2619. <td valign="top">keystore type</td>
  2620. <td valign="top" align="center">No</td>
  2621. </tr>
  2622. <tr>
  2623. <td valign="top">keypass</td>
  2624. <td valign="top">password for private key (if different)</td>
  2625. <td valign="top" align="center">No</td>
  2626. </tr>
  2627. <tr>
  2628. <td valign="top">sigfile</td>
  2629. <td valign="top">name of .SF/.DSA file</td>
  2630. <td valign="top" align="center">No</td>
  2631. </tr>
  2632. <tr>
  2633. <td valign="top">signedjar</td>
  2634. <td valign="top">name of signed JAR file</td>
  2635. <td valign="top" align="center">No</td>
  2636. </tr>
  2637. <tr>
  2638. <td valign="top">verbose</td>
  2639. <td valign="top">(true | false) verbose output when signing</td>
  2640. <td valign="top" align="center">No</td>
  2641. </tr>
  2642. <tr>
  2643. <td valign="top">internalsf</td>
  2644. <td valign="top">(true | false) include the .SF file inside the signature
  2645. block</td>
  2646. <td valign="top" align="center">No</td>
  2647. </tr>
  2648. <tr>
  2649. <td valign="top">sectionsonly</td>
  2650. <td valign="top">(true | false) don't compute hash of entire manifest</td>
  2651. <td valign="top" align="center">No</td>
  2652. </tr>
  2653. </table>
  2654. <h3>Examples</h3>
  2655. <blockquote>
  2656. <p><code>&lt;signjar jar=&quot;${dist}/lib/ant.jar&quot;
  2657. alias=&quot;apache-group&quot; storepass=&quot;secret&quot; /&gt;</code></p>
  2658. </blockquote>
  2659. <p>signs the ant.jar with alias &quot;apache-group&quot; accessing the
  2660. keystore and private key via &quot;secret&quot; password.</p>
  2661. <hr>
  2662. <h2><a name="tar">Tar</a></h2>
  2663. <h3>Description</h3>
  2664. <p>Creates a tar archive.</p>
  2665. <p>The <i>basedir</i> attribute is the reference directory from where to tar.</p>
  2666. <p>It is possible to refine the set of files that are being tarred. This can be
  2667. done with the <i>includes</i>, <i>includesfile</i>, <i>excludes</i>, <i>excludesfile</i> and <i>defaultexcludes</i>
  2668. attributes. With the <i>includes</i> or <i>includesfile</i> attribute you specify the files you want to
  2669. have included by using patterns. The <i>exclude</i> or <i>excludesfile</i> attribute is used to specify
  2670. the files you want to have excluded. This is also done with patterns. And
  2671. finally with the <i>defaultexcludes</i> attribute, you can specify whether you
  2672. want to use default exclusions or not. See the section on <a
  2673. href="#directorybasedtasks">directory based tasks</a>, on how the
  2674. inclusion/exclusion of files works, and how to write patterns. The patterns are
  2675. relative to the <i>basedir</i> directory.</p>
  2676. <p>The <i>includes</i>, <i>excludes</i> and <i>defaultexcludes</i> attributes
  2677. replace the <i>items</i> and <i>ignore</i> attributes. The following explains
  2678. how the deprecated <i>items</i> and <i>ignore</i> attribute behave.</p>
  2679. <p>When &quot;*&quot; is used for <i>items</i>, all files in the basedir, and
  2680. its subdirectories, will be tarred. Otherwise all the files and directories
  2681. mentioned in the items list will tarred. When a directory is specified, then all
  2682. files within it are also tarred.</p>
  2683. <p>With the <i>ignore</i> attribute, you can specify files or directories to
  2684. ignore. These files will not be tarred. The items in the <i>ignore</i> attribute
  2685. override the items in the <i>items</i> attribute. The names specified in the <i>ignore</i>
  2686. attribute are just names, they do not contain any path information!</p>
  2687. <p>Note that this task does not perform compression. You might want to use the <a href="#gzip">GZip</a>
  2688. task to come up with a .tar.gz package.</p>
  2689. <h3>Parameters</h3>
  2690. <table border="1" cellpadding="2" cellspacing="0">
  2691. <tr>
  2692. <td valign="top"><b>Attribute</b></td>
  2693. <td valign="top"><b>Description</b></td>
  2694. <td valign="top" align="center"><b>Required</b></td>
  2695. </tr>
  2696. <tr>
  2697. <td valign="top">tarfile</td>
  2698. <td valign="top">the tar-file to create.</td>
  2699. <td align="center" valign="top">Yes</td>
  2700. </tr>
  2701. <tr>
  2702. <td valign="top">basedir</td>
  2703. <td valign="top">the directory from which to zip the files.</td>
  2704. <td align="center" valign="top">Yes</td>
  2705. </tr>
  2706. <tr>
  2707. <td valign="top">includes</td>
  2708. <td valign="top">comma separated list of patterns of files that must be
  2709. included. All files are included when omitted.</td>
  2710. <td valign="top" align="center">No</td>
  2711. </tr>
  2712. <tr>
  2713. <td valign="top">includesfile</td>
  2714. <td valign="top">the name of a file. Each line of this file is
  2715. taken to be an include pattern</td>
  2716. <td valign="top" align="center">No</td>
  2717. </tr>
  2718. <tr>
  2719. <td valign="top">excludes</td>
  2720. <td valign="top">comma separated list of patterns of files that must be
  2721. excluded. No files (except default excludes) are excluded when omitted.</td>
  2722. <td valign="top" align="center">No</td>
  2723. </tr>
  2724. <tr>
  2725. <td valign="top">excludesfile</td>
  2726. <td valign="top">the name of a file. Each line of this file is
  2727. taken to be an exclude pattern</td>
  2728. <td valign="top" align="center">No</td>
  2729. </tr>
  2730. <tr>
  2731. <td valign="top">defaultexcludes</td>
  2732. <td valign="top">indicates whether default excludes should be used or not
  2733. (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when omitted.</td>
  2734. <td valign="top" align="center">No</td>
  2735. </tr>
  2736. </table>
  2737. <h3>Examples</h3>
  2738. <pre> &lt;tar tarfile=&quot;${dist}/manual.tar&quot; basedir=&quot;htdocs/manual&quot; /&gt;
  2739. &lt;gzip zipfile=&quot;${dist}/manual.tar.gz&quot; src=&quot;${dist}/manual.tar&quot; /&gt;</pre>
  2740. <p>tars all files in the <code>htdocs/manual</code> directory in a file called <code>manual.tar</code>
  2741. in the <code>${dist}</code> directory, then applies the gzip task to compress
  2742. it.</p>
  2743. <pre> &lt;tar tarfile=&quot;${dist}/manual.tar&quot;
  2744. basedir=&quot;htdocs/manual&quot;
  2745. excludes=&quot;mydocs/**, **/todo.html&quot;
  2746. /&gt;</pre>
  2747. <p>tars all files in the <code>htdocs/manual</code> directory in a file called <code>manual.tar</code>
  2748. in the <code>${dist}</code> directory. Files in the directory <code>mydocs</code>,
  2749. or files with the name <code>todo.html</code> are excluded.</p>
  2750. <hr>
  2751. <h2><a name="taskdef">Taskdef</a></h2>
  2752. <h3>Description</h3>
  2753. <p>Adds a task definition to the current project, such that this new task can be
  2754. used in the current project. Two attributes are needed, the name that identifies
  2755. this task uniquely, and the full name of the class (including the packages) that
  2756. implements this task.</p>
  2757. <p>Taskdef should be used to add your own tasks to the system. See also &quot;<a
  2758. href="#writingowntask">Writing your own task</a>&quot;.</p>
  2759. <h3>Parameters</h3>
  2760. <table border="1" cellpadding="2" cellspacing="0">
  2761. <tr>
  2762. <td valign="top"><b>Attribute</b></td>
  2763. <td valign="top"><b>Description</b></td>
  2764. <td align="center" valign="top"><b>Required</b></td>
  2765. </tr>
  2766. <tr>
  2767. <td valign="top">name</td>
  2768. <td valign="top">the name of the task</td>
  2769. <td valign="top" align="center">Yes</td>
  2770. </tr>
  2771. <tr>
  2772. <td valign="top">classname</td>
  2773. <td valign="top">the full class name implementing the task</td>
  2774. <td valign="top" align="center">Yes</td>
  2775. </tr>
  2776. </table>
  2777. <h3>Examples</h3>
  2778. <pre> &lt;taskdef name=&quot;myjavadoc&quot; classname=&quot;com.mydomain.JavadocTask&quot; /&gt;</pre>
  2779. <p>makes a task called <code>myjavadoc</code> available to Ant. The class <code>com.mydomain.JavadocTask</code>
  2780. implements the task.</p>
  2781. <hr>
  2782. <h2><a name="touch">Touch</a></h2>
  2783. <h3>Description</h3>
  2784. <p>Changes the modification time of a file and possibly creates it at
  2785. the same time.</p>
  2786. <p>For JDK 1.1 only the creation of new files with a modification time
  2787. of now works, all other cases will emit a warning.</p>
  2788. <h3>Parameters</h3>
  2789. <table border="1" cellpadding="2" cellspacing="0">
  2790. <tr>
  2791. <td valign="top"><b>Attribute</b></td>
  2792. <td valign="top"><b>Description</b></td>
  2793. <td align="center" valign="top"><b>Required</b></td>
  2794. </tr>
  2795. <tr>
  2796. <td valign="top">file</td>
  2797. <td valign="top">the name of the file</td>
  2798. <td valign="top" align="center">Yes</td>
  2799. </tr>
  2800. <tr>
  2801. <td valign="top">millis</td>
  2802. <td valign="top">specifies the new modification time of the file
  2803. in milliseconds since midnight Jan 1 1970</td>
  2804. <td valign="top" align="center">No</td>
  2805. </tr>
  2806. <tr>
  2807. <td valign="top">datetime</td>
  2808. <td valign="top">specifies the new modification time of the file
  2809. in the format MM/DD/YYYY HH:MM AM_or_PM.</td>
  2810. <td valign="top" align="center">No</td>
  2811. </tr>
  2812. </table>
  2813. <p>If both <code>millis</code> and <code>datetime</code> are ommited
  2814. the current time is assumed.</p>
  2815. <h3>Examples</h3>
  2816. <pre> &lt;touch file=&quot;myfile&quot; /&gt;</pre>
  2817. <p>creates <code>myfile</code> if it doesn't exist and changes the
  2818. modification time to the current time.</p>
  2819. <pre> &lt;touch file=&quot;myfile&quot; datetime=&quot;06/28/2000 2:02 pm&quot; /&gt;</pre>
  2820. <p>creates <code>myfile</code> if it doesn't exist and changes the
  2821. modification time to Jun, 28 2000 2:02 pm (14:02 for those used to 24
  2822. hour times).</p>
  2823. <hr>
  2824. <h2><a name="tstamp">Tstamp</a></h2>
  2825. <h3>Description</h3>
  2826. <p>Sets the DSTAMP, TSTAMP and TODAY properties in the current project. The
  2827. DSTAMP is in the &quot;yyyymmdd&quot; format, the TSTAMP is in the &quot;hhmm&quot;
  2828. format and TODAY is &quot;month day year&quot;.</p>
  2829. <p>These properties can be used in the buildfile, for instance, to create
  2830. timestamped filenames or used to replace placeholder tags inside documents to
  2831. indicate, for example, the release date. The best place for this task is in your
  2832. initialization target.</p>
  2833. <h3>Parameters</h3>
  2834. <table border="1" cellpadding="2" cellspacing="0">
  2835. <tr>
  2836. <td valign="top"><b>Attribute</b></td>
  2837. <td valign="top"><b>Description</b></td>
  2838. <td align="center" valign="top"><b>Required</b></td>
  2839. </tr>
  2840. </table>
  2841. <h3>Examples</h3>
  2842. <pre> &lt;tstamp/&gt;</pre>
  2843. <hr>
  2844. <h2><a name="style">Style</a></h2>
  2845. <h3>Description</h3>
  2846. <p>Process a set of documents via XSLT.</p>
  2847. <p>This is useful for building views of XML based documentation,
  2848. or in generating code.</p>
  2849. <p>It is possible to refine the set of files that are being copied. This can be
  2850. done with the <i>includes</i>, <i>includesfile</i>, <i>excludes</i>, <i>excludesfile</i> and <i>defaultexcludes</i>
  2851. attributes. With the <i>includes</i> or <i>includesfile</i> attribute you specify the files you want to
  2852. have included by using patterns. The <i>exclude</i> or <i>excludesfile</i> attribute is used to specify
  2853. the files you want to have excluded. This is also done with patterns. And
  2854. finally with the <i>defaultexcludes</i> attribute, you can specify whether you
  2855. want to use default exclusions or not. See the section on <a
  2856. href="#directorybasedtasks">directory based tasks</a>, on how the
  2857. inclusion/exclusion of files works, and how to write patterns. The patterns are
  2858. relative to the <i>basedir</i> directory.</p>
  2859. <h3>Parameters</h3>
  2860. <table border="1" cellpadding="2" cellspacing="0">
  2861. <tr>
  2862. <td valign="top"><b>Attribute</b></td>
  2863. <td valign="top"><b>Description</b></td>
  2864. <td align="center" valign="top"><b>Required</b></td>
  2865. </tr>
  2866. <tr>
  2867. <td valign="top">basedir</td>
  2868. <td valign="top">where to find the source xml file.</td>
  2869. <td align="center" valign="top">Yes</td>
  2870. </tr>
  2871. <tr>
  2872. <td valign="top">destdir</td>
  2873. <td valign="top">directory where to store the results.</td>
  2874. <td align="center" valign="top">Yes</td>
  2875. </tr>
  2876. <tr>
  2877. <td valign="top">extention</td>
  2878. <td valign="top">desired file extension to be used for the targets.
  2879. If not specified, the default is "html".</td>
  2880. <td align="center" valign="top">No</td>
  2881. </tr>
  2882. <tr>
  2883. <td valign="top">style</td>
  2884. <td valign="top">name of the stylesheet to use.</td>
  2885. <td align="center" valign="top">Yes</td>
  2886. </tr>
  2887. <tr>
  2888. <td valign="top">processor</td>
  2889. <td valign="top">name of the XSLT processor to use. Permissable
  2890. values are "xslp" for the XSL:P processor, "xalan" for the Apache XML Xalan
  2891. processor, or the name of an arbitrary XSLTLiaison class.
  2892. Defaults to xslp or xalan (in that order), if one is found in your
  2893. class path</td>
  2894. <td align="center" valign="top">No</td>
  2895. </tr>
  2896. <tr>
  2897. <td valign="top">includes</td>
  2898. <td valign="top">comma separated list of patterns of files that must be
  2899. included. All files are included when omitted.</td>
  2900. <td valign="top" align="center">No</td>
  2901. </tr>
  2902. <tr>
  2903. <td valign="top">includesfile</td>
  2904. <td valign="top">the name of a file. Each line of this file is
  2905. taken to be an include pattern</td>
  2906. <td valign="top" align="center">No</td>
  2907. </tr>
  2908. <tr>
  2909. <td valign="top">excludes</td>
  2910. <td valign="top">comma separated list of patterns of files that must be
  2911. excluded. No files (except default excludes) are excluded when omitted.</td>
  2912. <td valign="top" align="center">No</td>
  2913. </tr>
  2914. <tr>
  2915. <td valign="top">excludesfile</td>
  2916. <td valign="top">the name of a file. Each line of this file is
  2917. taken to be an exclude pattern</td>
  2918. <td valign="top" align="center">No</td>
  2919. </tr>
  2920. <tr>
  2921. <td valign="top">defaultexcludes</td>
  2922. <td valign="top">indicates whether default excludes should be used or not
  2923. (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when omitted.</td>
  2924. <td valign="top" align="center">No</td>
  2925. </tr>
  2926. </table>
  2927. <h3>Examples</h3>
  2928. <blockquote>
  2929. <p><pre>
  2930. &lt;style basedir=&quot;doc&quot; destdir=&quot;build/doc&quot;
  2931. extension=&quot;html&quot; style=&quot;style/apache.xml&quot;/&gt;
  2932. </pre></p>
  2933. </blockquote>
  2934. <hr>
  2935. <h2><a name="untar">Untar</a></h2>
  2936. <h3>Description</h3>
  2937. <p>Untars a tarfile.</p>
  2938. <p>For JDK 1.1 "last modified time" field is set to current time instead of being
  2939. carried from tarfile.</p>
  2940. <h3>Parameters</h3>
  2941. <table border="1" cellpadding="2" cellspacing="0">
  2942. <tr>
  2943. <td valign="top"><b>Attribute</b></td>
  2944. <td valign="top"><b>Description</b></td>
  2945. <td align="center" valign="top"><b>Required</b></td>
  2946. </tr>
  2947. <tr>
  2948. <td valign="top">src</td>
  2949. <td valign="top">tarfile to expand.</td>
  2950. <td align="center" valign="top">Yes</td>
  2951. </tr>
  2952. <tr>
  2953. <td valign="top">dest</td>
  2954. <td valign="top">directory where to store the expanded files.</td>
  2955. <td align="center" valign="top">Yes</td>
  2956. </tr>
  2957. </table>
  2958. <h3>Examples</h3>
  2959. <blockquote>
  2960. <p><code>
  2961. &lt;gunzip src=&quot;tools.tar.gz&quot;/&gt;<br>
  2962. &lt;untar src=&quot;tools.tar&quot; dest=&quot;${tools.home}&quot;/&gt;
  2963. </code></p>
  2964. </blockquote>
  2965. <hr>
  2966. <h2><a name="zip">Zip</a></h2>
  2967. <h3>Description</h3>
  2968. <p>Creates a zipfile.</p>
  2969. <p>The <i>basedir</i> attribute is the reference directory from where to zip.</p>
  2970. <p>It is possible to refine the set of files that are being zipped. This can be
  2971. done with the <i>includes</i>, <i>includesfile</i>, <i>excludes</i>, <i>excludesfile</i> and <i>defaultexcludes</i>
  2972. attributes. With the <i>includes</i> or <i>includesfile</i> attribute you specify the files you want to
  2973. have included by using patterns. The <i>exclude</i> or <i>excludesfile</i> attribute is used to specify
  2974. the files you want to have excluded. This is also done with patterns. And
  2975. finally with the <i>defaultexcludes</i> attribute, you can specify whether you
  2976. want to use default exclusions or not. See the section on <a
  2977. href="#directorybasedtasks">directory based tasks</a>, on how the
  2978. inclusion/exclusion of files works, and how to write patterns. The patterns are
  2979. relative to the <i>basedir</i> directory.</p>
  2980. <p>The <i>includes</i>, <i>excludes</i> and <i>defaultexcludes</i> attributes
  2981. replace the <i>items</i> and <i>ignore</i> attributes. The following explains
  2982. how the deprecated <i>items</i> and <i>ignore</i> attribute behave.</p>
  2983. <p>When &quot;*&quot; is used for <i>items</i>, all files in the basedir, and
  2984. its subdirectories, will be zipped. Otherwise all the files and directories
  2985. mentioned in the items list will zipped. When a directory is specified, then all
  2986. files within it are also zipped.</p>
  2987. <p>With the <i>ignore</i> attribute, you can specify files or directories to
  2988. ignore. These files will not be zipped. The items in the <i>ignore</i> attribute
  2989. override the items in the <i>items</i> attribute. The names specified in the <i>ignore</i>
  2990. attribute are just names, they do not contain any path information!</p>
  2991. <h3>Parameters</h3>
  2992. <table border="1" cellpadding="2" cellspacing="0">
  2993. <tr>
  2994. <td valign="top"><b>Attribute</b></td>
  2995. <td valign="top"><b>Description</b></td>
  2996. <td valign="top" align="center"><b>Required</b></td>
  2997. </tr>
  2998. <tr>
  2999. <td valign="top">zipfile</td>
  3000. <td valign="top">the zip-file to create.</td>
  3001. <td align="center" valign="top">Yes</td>
  3002. </tr>
  3003. <tr>
  3004. <td valign="top">basedir</td>
  3005. <td valign="top">the directory from which to zip the files.</td>
  3006. <td align="center" valign="top">Yes</td>
  3007. </tr>
  3008. <tr>
  3009. <td valign="top">compress</td>
  3010. <td valign="top">Not only store data but also compress them, defaults to true</td>
  3011. <td align="center" valign="top">No</td>
  3012. </tr>
  3013. <tr>
  3014. <td valign="top">items</td>
  3015. <td valign="top">a comma separated list of the files/directories to zip. All
  3016. files are included when omitted. (<b>deprecated</b>, use <i>includes</i>
  3017. instead).</td>
  3018. <td valign="top" align="center">No</td>
  3019. </tr>
  3020. <tr>
  3021. <td valign="top">ignore</td>
  3022. <td valign="top">comma separated list of filenames/directorynames to exclude
  3023. from the zip. No files (except default excludes) are excluded when
  3024. omitted. (<b>deprecated</b>, use <i>excludes</i> instead).</td>
  3025. <td valign="top" align="center">No</td>
  3026. </tr>
  3027. <tr>
  3028. <td valign="top">includes</td>
  3029. <td valign="top">comma separated list of patterns of files that must be
  3030. included. All files are included when omitted.</td>
  3031. <td valign="top" align="center">No</td>
  3032. </tr>
  3033. <tr>
  3034. <td valign="top">includesfile</td>
  3035. <td valign="top">the name of a file. Each line of this file is
  3036. taken to be an include pattern</td>
  3037. <td valign="top" align="center">No</td>
  3038. </tr>
  3039. <tr>
  3040. <td valign="top">excludes</td>
  3041. <td valign="top">comma separated list of patterns of files that must be
  3042. excluded. No files (except default excludes) are excluded when omitted.</td>
  3043. <td valign="top" align="center">No</td>
  3044. </tr>
  3045. <tr>
  3046. <td valign="top">excludesfile</td>
  3047. <td valign="top">the name of a file. Each line of this file is
  3048. taken to be an exclude pattern</td>
  3049. <td valign="top" align="center">No</td>
  3050. </tr>
  3051. <tr>
  3052. <td valign="top">defaultexcludes</td>
  3053. <td valign="top">indicates whether default excludes should be used or not
  3054. (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when omitted.</td>
  3055. <td valign="top" align="center">No</td>
  3056. </tr>
  3057. </table>
  3058. <h3>Examples</h3>
  3059. <pre> &lt;zip zipfile=&quot;${dist}/manual.zip&quot;
  3060. basedir=&quot;htdocs/manual&quot;
  3061. /&gt;</pre>
  3062. <p>zips all files in the <code>htdocs/manual</code> directory in a file called <code>manual.zip</code>
  3063. in the <code>${dist}</code> directory.</p>
  3064. <pre> &lt;zip zipfile=&quot;${dist}/manual.zip&quot;
  3065. basedir=&quot;htdocs/manual&quot;
  3066. excludes=&quot;mydocs/**, **/todo.html&quot;
  3067. /&gt;</pre>
  3068. <p>zips all files in the <code>htdocs/manual</code> directory in a file called <code>manual.zip</code>
  3069. in the <code>${dist}</code> directory. Files in the directory <code>mydocs</code>,
  3070. or files with the name <code>todo.html</code> are excluded.</p>
  3071. <pre> &lt;zip zipfile=&quot;${dist}/manual.zip&quot;
  3072. basedir=&quot;htdocs/manual&quot;
  3073. includes=&quot;api/**/*.html&quot;
  3074. excludes=&quot;**/todo.html&quot;
  3075. /&gt;</pre>
  3076. <p>zips all files in the <code>htdocs/manual</code> directory in a file called <code>manual.zip</code>
  3077. in the <code>${dist}</code> directory. Only html files under the directory <code>api</code>
  3078. are zipped, and files with the name <code>todo.html</code> are excluded.</p>
  3079. <h3>Deprecated examples</h3>
  3080. <pre> &lt;zip zipfile=&quot;${dist}/manual.zip&quot;
  3081. basedir=&quot;htdocs/manual&quot;
  3082. items=&quot;*&quot;
  3083. /&gt;</pre>
  3084. <p>zips all files in the <code>htdocs/manual</code> directory in a file called <code>manual.zip</code>
  3085. in the <code>${dist}</code> directory.</p>
  3086. <pre> &lt;zip zipfile=&quot;${dist}/manual.zip&quot;
  3087. basedir=&quot;htdocs/manual&quot;
  3088. items=&quot;*&quot;
  3089. ignore=&quot;mydocs, todo.html&quot;
  3090. /&gt;</pre>
  3091. <p>zips all files in the <code>htdocs/manual</code> directory in a file called <code>manual.zip</code>
  3092. in the <code>${dist}</code> directory. Files/directories with the names <code>mydocs</code>
  3093. and <code>todo.html</code> are excluded.</p>
  3094. <hr>
  3095. <h2><a name="buildevents">Build Events</a></h2>
  3096. Ant is capable of generating build events as it performs the tasks necessary to build a project.
  3097. Listeners can be attached to ant to receive these events. This capability could be used, for example,
  3098. to connect Ant to a GUI or to integrate Ant with an IDE.
  3099. <p>To use build events you need to create an ant <code>Project</code> object. You can then call the
  3100. <code>addBuildListener</code> method to add your listener to the project. Your listener must implement
  3101. the <code>org.apache.tools.antBuildListener</code> interface. The listener will receive BuildEvents
  3102. for the following events
  3103. <ul>
  3104. <li>Build started
  3105. <li>Build finished
  3106. <li>Target started
  3107. <li>Target finished
  3108. <li>Task started
  3109. <li>Task finished
  3110. <li>Message logged
  3111. </ul>
  3112. If you wish to attach a listener from the command line you may use the -listener option. For example
  3113. <blockquote>
  3114. <pre>ant -listener org.apache.tools.ant.XmlLogger</pre>
  3115. </blockquote>
  3116. will run ant with a listener which generates an XML representaion of the build progress. This
  3117. listener is included with ant as is the default listener which generates the logging to standard
  3118. output.
  3119. <hr>
  3120. <h2><a name="writingowntask">Writing your own task</a></h2>
  3121. <p>It is very easy to write your own task:</p>
  3122. <ol>
  3123. <li>Create a Java class that extends <code>org.apache.tools.ant.Task</code>.</li>
  3124. <li>For each attribute, write a setter method. The setter method must be a
  3125. <code>public void</code> method that takes a single argument. The
  3126. name of the method must begin with &quot;set&quot;, followed by the
  3127. attribute name, with the first character in uppercase, and the rest in
  3128. lowercase. The type of the attribute can be <code>String</code>, any
  3129. primitive type, <code>Class</code>, <code>File</code> (in which case the
  3130. value of the attribute is interpreted relative to the project's basedir)
  3131. or any other type that has a constructor with a single <code>String</code>
  3132. argument</li>
  3133. <li>If your task has enumerated attributes, you should consider using
  3134. a subclass of org.apache.tools.ant.EnumeratedAttribute as argument
  3135. to your setter method. See org.apache.tools.ant.taskdefs.FixCRLF for
  3136. an example.</li>
  3137. <li>If the task should support character data, write a <code>public void
  3138. addText(String)</code> method.</li>
  3139. <li>For each nested element, write a create or add method. A create method
  3140. must be a <code>public</code> method that takes no arguments and returns
  3141. an Object type. The name of the create method must begin with
  3142. &quot;create&quot;, followed by the element name. An add method must be
  3143. a <code>public void</code> method that takes a single argument of an
  3144. Object type with a no argument constructor. The name of the add method
  3145. must begin with &quot;add&quot;, followed by the element name.
  3146. <li>Write a <code>public void execute</code> method, with no arguments, that
  3147. throws a <code>BuildException</code>. This method implements the task
  3148. itself.</li>
  3149. </ol>
  3150. <p>It is important to know that Ant first calls the setters for the attributes
  3151. it encounters for a specific task in the buildfile, before it executes is.</p>
  3152. <p>Let's write our own task, that prints a message on the System.out stream. The
  3153. task has one attribute called &quot;message&quot;.</p>
  3154. <blockquote>
  3155. <pre>package com.mydomain;
  3156. import org.apache.tools.ant.BuildException;
  3157. import org.apache.tools.ant.Task;
  3158. public class MyVeryOwnTask extends Task {
  3159. private String msg;
  3160. // The method executing the task
  3161. public void execute() throws BuildException {
  3162. System.out.println(msg);
  3163. }
  3164. // The setter for the &quot;message&quot; attribute
  3165. public void setMessage(String msg) {
  3166. this.msg = msg;
  3167. }
  3168. }</pre>
  3169. </blockquote>
  3170. <p>It's really this simple;-)</p>
  3171. <p>Adding your task to the system is rather simple too:</p>
  3172. <ol>
  3173. <li>Make sure the class that implements your task is in the classpath when
  3174. starting Ant.</li>
  3175. <li>In your initialization target, add a <i>taskdef</i> task. This actually adds
  3176. your task to the system.</li>
  3177. <li>Use your task in the rest of the buildfile.</li>
  3178. </ol>
  3179. <h3>Example</h3>
  3180. <blockquote>
  3181. <pre>&lt;?xml version=&quot;1.0&quot;?&gt;
  3182. &lt;project name=&quot;OwnTaskExample&quot; default=&quot;main&quot; basedir=&quot;.&quot;&gt;
  3183. &lt;target name=&quot;init&quot;&gt;
  3184. &lt;taskdef name=&quot;mytask&quot; classname=&quot;com.mydomain.MyVeryOwnTask&quot;/&gt;
  3185. &lt;/target&gt;
  3186. &lt;target name=&quot;main&quot; depends=&quot;init&quot;&gt;
  3187. &lt;mytask message=&quot;Hello World! MyVeryOwnTask works!&quot; /&gt;
  3188. &lt;/target&gt;
  3189. &lt;/project&gt;
  3190. </pre>
  3191. </blockquote>
  3192. <p>Another way to add a task (more permanently), is to add the task name and
  3193. implementing class name to the <code>default.properties</code> file in the <code>org.apache.tools.ant.taskdefs</code>
  3194. package. Then you can use it as if it were a built in task.</p>
  3195. <hr>
  3196. <h2><a name="faq">FAQ, DTD, external resources</a></h2>
  3197. <p>There is an online FAQ for Ant at <a
  3198. href="http://jakarta.apache.org/jyve-faq/Turbine/screen/DisplayTopics/action/SetAll/project_id/2/faq_id/16">jakarta.apache.org</a>. This
  3199. FAQ is interactive, which means you can ask and answer questions
  3200. online.</p>
  3201. <p>One of the questions poping up quite often is "Is there a DTD for
  3202. buildfiles?". Please refer to the FAQ for an answer.</p>
  3203. <p>The FAQ contains lists of known custom tasks that don't ship with
  3204. Ant and projects that use Ant. Feel free to add your own task or project
  3205. there.</p>
  3206. <h2><a name="feedback">Feedback</a></h2>
  3207. <p>To provide feedback on this software, please subscribe to the Ant Development
  3208. Mail List <a href="mailto:(ant-dev-subscribe@jakarta.apache.org">(ant-dev-subscribe@jakarta.apache.org</a>)</p>
  3209. <hr>
  3210. <p align="center">Copyright � 2000 Apache Software Foundation. All rights
  3211. Reserved.</p>
  3212. <h2><a name="optionaltasks">Optional tasks</a></h2>
  3213. <ul>
  3214. <li><a href="#netrexxc">NetRexxC</a></li>
  3215. <li><a href="#renameexts">RenameExtensions</a></li>
  3216. <li><a href="#script">Script</a></li>
  3217. </ul>
  3218. <hr>
  3219. <h2><a name="netrexxc">NetRexxC</a></h2>
  3220. <h3><b>Description:</b></h3>
  3221. <p>Compiles a <a href="http://www2.hursley.ibm.com/netrexx">NetRexx</a>
  3222. source tree within the running (Ant) VM.</p>
  3223. <p>The source and destination directory will be recursively scanned for
  3224. NetRexx source files to compile. Only NetRexx files that have no corresponding
  3225. class file or where the class file is older than the java file will be compiled.</p>
  3226. <p>Files in the source tree are copied to the destination directory,
  3227. allowing support files to be located properly in the classpath. The source
  3228. files are copied because the NetRexx compiler cannot produce class files in a
  3229. specific directory via parameters</p>
  3230. <p>The directory structure of the source tree should follow the package
  3231. hierarchy.</p>
  3232. <p>It is possible to refine the set of files that are being compiled/copied.
  3233. This can be done with the <i>includes</i>, <i>includesfile</i>, <i>excludes</i>, <i>excludesfile</i> and
  3234. <i>defaultexcludes</i> attributes. With the <i>includes</i> or <i>includesfile</i> attribute you
  3235. specify the files you want to have included by using patterns. The
  3236. <i>exclude</i> or <i>excludesfile</i> attribute is used to specify the files you want to have
  3237. excluded. This is also done with patterns. And finally with the
  3238. <i>defaultexcludes</i> attribute, you can specify whether you
  3239. want to use default exclusions or not. See the section on <a
  3240. href="#directorybasedtasks">directory based tasks</a>, on how the
  3241. inclusion/exclusion of files works, and how to write patterns. The
  3242. patterns are relative to the <i>srcDir</i> directory.</p>
  3243. <h3>Parameters:</h3>
  3244. <table border="1" cellpadding="2" cellspacing="0">
  3245. <tr>
  3246. <td valign="top"><b>Attribute</b></td>
  3247. <td valign="top"><b>Description</b></td>
  3248. <td align="center" valign="top"><b>Required</b></td>
  3249. </tr>
  3250. <tr>
  3251. <td valign="top">binary</td>
  3252. <td valign="top">Whether literals are treated as the java binary
  3253. type rather than the NetRexx types</td>
  3254. <td valign="top" align="center">No</td>
  3255. </tr>
  3256. <tr>
  3257. <td valign="top">classpath</td>
  3258. <td valign="top">The classpath to use during compilation</td>
  3259. <td valign="top" align="center">No</td>
  3260. </tr>
  3261. <tr>
  3262. <td valign="top">comments</td>
  3263. <td valign="top">Whether comments are passed through to the
  3264. generated java source</td>
  3265. <td valign="top" align="center">No</td>
  3266. </tr>
  3267. <tr>
  3268. <td valign="top">compact</td>
  3269. <td valign="top">Whether error messages come out in compact or
  3270. verbose format</td>
  3271. <td valign="top" align="center">No</td>
  3272. </tr>
  3273. <tr>
  3274. <td valign="top">compile</td>
  3275. <td valign="top">Whether the NetRexx compiler should compile the
  3276. generated java code</td>
  3277. <td valign="top" align="center">No</td>
  3278. </tr>
  3279. <tr>
  3280. <td valign="top">console</td>
  3281. <td valign="top">Whether or not messages should be displayed on the
  3282. 'console'</td>
  3283. <td valign="top" align="center">No</td>
  3284. </tr>
  3285. <tr>
  3286. <td valign="top">crossref</td>
  3287. <td valign="top">Whether variable cross references are generated</td>
  3288. <td valign="top" align="center">No</td>
  3289. </tr>
  3290. <tr>
  3291. <td valign="top">decimal</td>
  3292. <td valign="top">Whether decimal arithmetic should be used for the
  3293. NetRexx code</td>
  3294. <td valign="top" align="center">No</td>
  3295. </tr>
  3296. <tr>
  3297. <td valign="top">defaultexcludes</td>
  3298. <td valign="top">indicates whether default excludes should be used or not
  3299. (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when
  3300. omitted.</td>
  3301. <td valign="top" align="center">No</td>
  3302. </tr>
  3303. <tr>
  3304. <td valign="top">destDir</td>
  3305. <td valign="top">the destination directory into which the NetRexx
  3306. source files should be copied and then compiled</td>
  3307. <td valign="top" align="center">Yes</td>
  3308. </tr>
  3309. <tr>
  3310. <td valign="top">diag</td>
  3311. <td valign="top">Whether diagnostic information about the compile is
  3312. generated</td>
  3313. <td valign="top" align="center">No</td>
  3314. </tr>
  3315. <tr>
  3316. <td valign="top">excludes</td>
  3317. <td valign="top">comma separated list of patterns of files that must be
  3318. excluded. No files (except default excludes) are excluded when
  3319. omitted.</td>
  3320. <td valign="top" align="center">No</td>
  3321. </tr>
  3322. <tr>
  3323. <td valign="top">excludesfile</td>
  3324. <td valign="top">the name of a file. Each line of this file is
  3325. taken to be an exclude pattern</td>
  3326. <td valign="top" align="center">No</td>
  3327. </tr>
  3328. <tr>
  3329. <td valign="top">explicit</td>
  3330. <td valign="top">Whether variables must be declared explicitly
  3331. before use</td>
  3332. <td valign="top" align="center">No</td>
  3333. </tr>
  3334. <tr>
  3335. <td valign="top">format</td>
  3336. <td valign="top">Whether the generated java code is formatted nicely
  3337. or left to match NetRexx line numbers for call stack debugging</td>
  3338. <td valign="top" align="center">No</td>
  3339. </tr>
  3340. <tr>
  3341. <td valign="top">includes</td>
  3342. <td valign="top">comma separated list of patterns of files that must be
  3343. included. All files are included when omitted.</td>
  3344. <td valign="top" align="center">No</td>
  3345. </tr>
  3346. <tr>
  3347. <td valign="top">includesfile</td>
  3348. <td valign="top">the name of a file. Each line of this file is
  3349. taken to be an include pattern</td>
  3350. <td valign="top" align="center">No</td>
  3351. </tr>
  3352. <tr>
  3353. <td valign="top">java</td>
  3354. <td valign="top">Whether the generated java code is produced</td>
  3355. <td valign="top" align="center">No</td>
  3356. </tr>
  3357. <tr>
  3358. <td valign="top">keep</td>
  3359. <td valign="top">Sets whether the generated java source file should be kept
  3360. after compilation. The generated files will have an extension of
  3361. .java.keep, <b>not</b> .java</td>
  3362. <td valign="top" align="center">No</td>
  3363. </tr>
  3364. <tr>
  3365. <td valign="top">logo</td>
  3366. <td valign="top">Whether the compiler text logo is displayed when
  3367. compiling</td>
  3368. <td valign="top" align="center">No</td>
  3369. </tr>
  3370. <tr>
  3371. <td valign="top">replace</td>
  3372. <td valign="top">Whether the generated .java file should be replaced
  3373. when compiling</td>
  3374. <td valign="top" align="center">No</td>
  3375. </tr>
  3376. <tr>
  3377. <td valign="top">savelog</td>
  3378. <td valign="top">Whether the compiler messages will be written to
  3379. NetRexxC.log as well as to the console</td>
  3380. <td valign="top" align="center">No</td>
  3381. </tr>
  3382. <tr>
  3383. <td valign="top">sourcedir</td>
  3384. <td valign="top">Tells the NetRexx compiler to store the class files in the
  3385. same directory as the source files. The alternative is the working
  3386. directory</td>
  3387. <td valign="top" align="center">No</td>
  3388. </tr>
  3389. <tr>
  3390. <td valign="top">srcDir</td>
  3391. <td valign="top">Set the source dir to find the source Netrexx
  3392. files</td>
  3393. <td valign="top" align="center">Yes</td>
  3394. </tr>
  3395. <tr>
  3396. <td valign="top">strictargs</td>
  3397. <td valign="top">Tells the NetRexx compiler that method calls always
  3398. need parentheses, even if no arguments are needed, e.g.
  3399. <code>aStringVar.getBytes</code> vs.
  3400. <code>aStringVar.getBytes()</code></td>
  3401. <td valign="top" align="center">No</td>
  3402. </tr>
  3403. <tr>
  3404. <td valign="top">strictassign</td>
  3405. <td valign="top">Tells the NetRexx compile that assignments must
  3406. match exactly on type</td>
  3407. <td valign="top" align="center">No</td>
  3408. </tr>
  3409. <tr>
  3410. <td valign="top">strictcase</td>
  3411. <td valign="top">Specifies whether the NetRexx compiler should be
  3412. case sensitive or not</td>
  3413. <td valign="top" align="center">No</td>
  3414. </tr>
  3415. <tr>
  3416. <td valign="top">strictimport</td>
  3417. <td valign="top">Whether classes need to be imported explicitly using an
  3418. <code>import</code> statement. By default the NetRexx compiler will
  3419. import certain packages automatically</td>
  3420. <td valign="top" align="center">No</td>
  3421. </tr>
  3422. <tr>
  3423. <td valign="top">strictprops</td>
  3424. <td valign="top">Whether local properties need to be qualified
  3425. explicitly using <code>this</code></td>
  3426. <td valign="top" align="center">No</td>
  3427. </tr>
  3428. <tr>
  3429. <td valign="top">strictsignal</td>
  3430. <td valign="top">Whether the compiler should force catching of
  3431. exceptions by explicitly named types</td>
  3432. <td valign="top" align="center">No</td>
  3433. </tr>
  3434. <tr>
  3435. <td valign="top">symbols</td>
  3436. <td valign="top">Whether debug symbols should be generated into the
  3437. class file</td>
  3438. <td valign="top" align="center">No</td>
  3439. </tr>
  3440. <tr>
  3441. <td valign="top">time</td>
  3442. <td valign="top">Asks the NetRexx compiler to print compilation
  3443. times to the console</td>
  3444. <td valign="top" align="center">No</td>
  3445. </tr>
  3446. <tr>
  3447. <td valign="top">trace</td>
  3448. <td valign="top">Turns on or off tracing and directs the resultant
  3449. trace output</td>
  3450. <td valign="top" align="center">No</td>
  3451. </tr>
  3452. <tr>
  3453. <td valign="top">utf8</td>
  3454. <td valign="top">Tells the NetRexx compiler that the source is in UTF8</td>
  3455. <td valign="top" align="center">No</td>
  3456. </tr>
  3457. <tr>
  3458. <td valign="top">verbose</td>
  3459. <td valign="top">Whether lots of warnings and error messages should
  3460. be generated</td>
  3461. <td valign="top" align="center">Yes</td>
  3462. </tr>
  3463. </table>
  3464. <h3>Examples</h3>
  3465. <blockquote>
  3466. <p><code>&lt;netrexxc srcDir=&quot;/source/project&quot;
  3467. includes=&quot;vnr/util/*&quot;
  3468. destDir=&quot;/source/project/build&quot;
  3469. classpath=&quot;/source/project2/proj.jar&quot;
  3470. comments=&quot;true&quot;
  3471. crossref=&quot;false&quot; replace=&quot;true&quot;
  3472. keep=&quot;true&quot; /&gt;</code>
  3473. </p>
  3474. </blockquote>
  3475. <hr>
  3476. <h2><a name="renameexts">RenameExtensions</a></h2>
  3477. <h3><b>Description:</b></h3>
  3478. <p>Renames files in the <code>srcDir</code> directory ending with the
  3479. <code>fromExtension</code> string so that they end with the
  3480. <code>toExtension</code> string. Files are only replaced if
  3481. <code>replace</code> is true
  3482. </p>
  3483. <p>See the section on
  3484. <a href="#directorybasedtasks">directory based tasks</a>, on how the
  3485. inclusion/exclusion of files works, and how to write patterns. The
  3486. patterns are relative to the <i>srcDir</i> directory.</p>
  3487. <h3>Parameters:</h3>
  3488. <table border="1" cellpadding="2" cellspacing="0">
  3489. <tr>
  3490. <td valign="top"><b>Attribute</b></td>
  3491. <td valign="top"><b>Description</b></td>
  3492. <td align="center" valign="top"><b>Required</b></td>
  3493. </tr>
  3494. <tr>
  3495. <td valign="top">defaultexcludes</td>
  3496. <td valign="top">indicates whether default excludes should be used or not
  3497. (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when
  3498. omitted.</td>
  3499. <td valign="top" align="center">No</td>
  3500. </tr>
  3501. <tr>
  3502. <td valign="top">excludes</td>
  3503. <td valign="top">comma separated list of patterns of files that must be
  3504. excluded. No files (except default excludes) are excluded when
  3505. omitted.</td>
  3506. <td valign="top" align="center">No</td>
  3507. </tr>
  3508. <tr>
  3509. <td valign="top">excludesfile</td>
  3510. <td valign="top">the name of a file. Each line of this file is
  3511. taken to be an exclude pattern</td>
  3512. <td valign="top" align="center">No</td>
  3513. </tr>
  3514. <tr>
  3515. <td valign="top">fromExtention</td>
  3516. <td valign="top">The string that files must end in to be renamed</td>
  3517. <td valign="top" align="center">Yes</td>
  3518. </tr>
  3519. <tr>
  3520. <td valign="top">includes</td>
  3521. <td valign="top">comma separated list of patterns of files that must be
  3522. included. All files are included when omitted.</td>
  3523. <td valign="top" align="center">No</td>
  3524. </tr>
  3525. <tr>
  3526. <td valign="top">includesfile</td>
  3527. <td valign="top">the name of a file. Each line of this file is
  3528. taken to be an include pattern</td>
  3529. <td valign="top" align="center">No</td>
  3530. </tr>
  3531. <tr>
  3532. <td valign="top">replace</td>
  3533. <td valign="top">Whether the file being renamed to should be
  3534. replaced if it already exists</td>
  3535. <td valign="top" align="center">No</td>
  3536. </tr>
  3537. <tr>
  3538. <td valign="top">srcDir</td>
  3539. <td valign="top">The starting directory for files to search in</td>
  3540. <td valign="top" align="center">Yes</td>
  3541. </tr>
  3542. <tr>
  3543. <td valign="top">toExtension</td>
  3544. <td valign="top">The string that renamed files will end with on
  3545. completion</td>
  3546. <td valign="top" align="center">Yes</td>
  3547. </tr>
  3548. </table>
  3549. <h3>Examples</h3>
  3550. <blockquote>
  3551. <p><code>&lt;renameext srcDir=&quot;/source/project1&quot;
  3552. includes=&quot;**&quot;
  3553. excludes=&quot;**/samples/*&quot;
  3554. fromExtension=&quot;.java.keep&quot;
  3555. toExtension=&quot;.java&quot;
  3556. replace=&quot;true&quot; /&gt;
  3557. </code>
  3558. </p>
  3559. </blockquote>
  3560. <hr>
  3561. <h2><a name="script">Script</a></h2>
  3562. <h3><b>Description:</b></h3>
  3563. <p>Execute a script in a
  3564. <a href="http://www.alphaworks.ibm.com/tech/bsf">BSF</a> supported language.
  3565. <p>All items (tasks, targets, etc) of the running project are accessible
  3566. from the script.
  3567. <h3>Parameters:</h3>
  3568. <table border="1" cellpadding="2" cellspacing="0">
  3569. <tr>
  3570. <td valign="top"><b>Attribute</b></td>
  3571. <td valign="top"><b>Description</b></td>
  3572. <td align="center" valign="top"><b>Required</b></td>
  3573. </tr>
  3574. <tr>
  3575. <td valign="top">language</td>
  3576. <td valign="top">The programming language the script is written in.
  3577. Must be a supported BSF language</td>
  3578. <td valign="top" align="center">No</td>
  3579. </tr>
  3580. <tr>
  3581. <td valign="top">src</td>
  3582. <td valign="top">The location of the script as a file, if not inline</td>
  3583. <td valign="top" align="center">No</td>
  3584. </tr>
  3585. </table>
  3586. <h3>Examples</h3>
  3587. <blockquote>
  3588. <p>None yet available</p>
  3589. </blockquote>
  3590. </body>
  3591. </html>