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

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