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

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