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

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