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

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