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

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