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

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