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

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