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

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