You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.html 216 kB

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