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

index.html 194 kB

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