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

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