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 263 KiB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <title>Ant User Manual</title>
  5. </head>
  6. <body>
  7. <center>
  8. <h1>Ant User Manual</h1>
  9. <p>by</p>
  10. </center>
  11. <!-- Names are in alphabetical order, on last name -->
  12. <ul>
  13. <li>Stephane Bailliez (<a href="mailto:sbailliez@imediation.com">sbailliez@imediation.com</a>)</li>
  14. <li>Jacques Bergeron (<a href="mailto:jacques.bergeron@dogico.com">jacques.bergeron@dogico.com</a>)</li>
  15. <li>Stefan Bodewig (<a href="mailto:stefan.bodewig@epost.de">stefan.bodewig@epost.de</a>)</li>
  16. <li>Patrick Chanezon (<a href="mailto:chanezon@netscape.com">chanezon@netscape.com</a>)</li>
  17. <li>James Duncan Davison (<a href="mailto:duncan@x180.com">duncan@x180.com</a>)</li>
  18. <li>Tom Dimock (<a href="mailto:tad1@cornell.edu">tad1@cornell.edu</a>)</li>
  19. <li>Diane Holt (<a href="mailto:holtdl@yahoo.com">holtdl@yahoo.com</a>)</li>
  20. <li>Bill Kelly (<a href="mailto:bill.kelly@softwired-inc.com">bill.kelly@softwired-inc.com</a>)</li>
  21. <li>Arnout J. Kuiper (<a href="mailto:ajkuiper@wxs.nl">ajkuiper@wxs.nl</a>)</li>
  22. <li>Conor MacNeill (<a href="mailto:conor@cortexebusiness.com.au">conor@cortexebusiness.com.au</a>)</li>
  23. <li>Stefano Mazzocchi (<a href="mailto:stefano@apache.org">stefano@apache.org</a>)</li>
  24. <li>Erik Meade (<a href="mailto:emeade@geekfarm.org">emeade@geekfarm.org</a>)</li>
  25. <li>Sam Ruby (<a href="mailto:rubys@us.ibm.com">rubys@us.ibm.com</a>)</li>
  26. <li>Nico Seessle (<a href="mailto:nico@seessle.de">nico@seessle.de</a>)</li>
  27. <li>Jon S. Stevens (<a href="mailto:jon@latchkey.com">jon@latchkey.com</a>)</li>
  28. <li>Roger Vaughn (<a href="mailto:rvaughn@seaconinc.com">rvaughn@seaconinc.com</a>)</li>
  29. <li>Dave Walend (<a href="mailto:dwalend@cs.tufts.edu">dwalend@cs.tufts.edu</a>)</li>
  30. </ul>
  31. <center>
  32. <p>Version: @VERSION@<br>
  33. $Id$</p>
  34. </center>
  35. <hr>
  36. <h2>Table of Contents</h2>
  37. <ul>
  38. <li><a href="#introduction">Introduction</a></li>
  39. <li><a href="#getting">Getting Ant</a></li>
  40. <li><a href="#sysrequirements">System Requirements</a></li>
  41. <li><a href="#installing">Installing Ant</a></li>
  42. <li><a href="#buildingant">Building Ant</a></li>
  43. <li><a href="#running">Running Ant</a></li>
  44. <li><a href="#buildfile">Writing a Simple Buildfile</a>
  45. <li><a href="#directorybasedtasks">Directory-based Tasks</a></li>
  46. <li><a href="#bitasks">Built-in Tasks</a>
  47. <li><a href="#optionaltasks">Optional Tasks</a>
  48. <li><a href="#buildevents">Build Events</a>
  49. <li><a href="#writingowntask">Writing Your Own Task</a></li>
  50. <li><a href="#faq">FAQ, DTD, External Resources</a>
  51. <li><a href="../LICENSE">License</a></li>
  52. <li><a href="#feedback">Feedback</a></li>
  53. </ul>
  54. <hr>
  55. <h2><a name="introduction">Introduction</a></h2>
  56. <p>Ant is a Java-based build tool. In theory, it is kind of like
  57. <i>make</i>, without <i>make</i>'s wrinkles.</p>
  58. <h3>Why?</h3>
  59. <p>Why another build tool when there is already
  60. <i>make</i>,
  61. <i>gnumake</i>,
  62. <i>nmake</i>,
  63. <i>jam</i>,
  64. and
  65. others? Because all those tools have limitations that Ant's original author
  66. couldn't live with when developing software across multiple platforms.
  67. Make-like
  68. tools are inherently shell-based: they evaluate a set of dependencies,
  69. then execute commands not unlike what you would issue on a shell.
  70. This means that you
  71. can easily extend these tools by using or writing any program for the OS that
  72. you are working on; however, this also means that you limit yourself to the OS,
  73. or at least the OS type, such as Unix, that you are working on.</p>
  74. <p>Makefiles are inherently evil as well. Anybody who has worked on them for any
  75. time has run into the dreaded tab problem. &quot;Is my command not executing
  76. because I have a space in front of my tab?!!&quot; said the original author of
  77. Ant way too many times. Tools like Jam took care of this to a great degree, but
  78. still have yet another format to use and remember.</p>
  79. <p>Ant is different. Instead of a model where it is extended with shell-based
  80. commands, Ant is extended using Java classes. Instead of writing shell commands,
  81. the configuration files are XML-based, calling out a target tree where various
  82. tasks get executed. Each task is run by an object that implements a particular
  83. Task interface.</p>
  84. <p>Granted, this removes some of the expressive power that is inherent in being
  85. able to construct a shell command such as
  86. <nobr><code>`find . -name foo -exec rm {}`</code></nobr>, but it
  87. gives you the ability to be cross-platform &#150; to work anywhere and
  88. everywhere. And
  89. hey, if you really need to execute a shell command, Ant has an
  90. &lt;exec&gt; task that
  91. allows different commands to be executed based on the OS it is executing
  92. on.</p>
  93. <hr>
  94. <h2><a name="getting">Getting Ant</a></h2>
  95. <h3>Binary edition</h3>
  96. <p>The latest stable version of Ant can be downloaded from <a
  97. href="http://jakarta.apache.org/builds/ant/release/v1.2/bin/">
  98. http://jakarta.apache.org/builds/ant/release/v1.2/bin/</a>.
  99. If you like living on the edge, you can download the latest version from <a
  100. href="http://jakarta.apache.org/builds/ant/nightly/">http://jakarta.apache.org/builds/ant/nightly/</a>.</p>
  101. <h3>Source Edition</h3>
  102. <p>If you prefer the source edition, you can download Ant from <a
  103. href="http://jakarta.apache.org/builds/ant/release/v1.2/src/">
  104. http://jakarta.apache.org/builds/ant/release/v1.2/src/</a>
  105. (latest stable) or from <a
  106. href="http://jakarta.apache.org/from-cvs/jakarta-tools/">http://jakarta.apache.org/from-cvs/jakarta-ant/</a>
  107. (current). See the section <a href="#buildingant">Building Ant</a> on how to
  108. build Ant from the source code.</p>
  109. <hr>
  110. <h2><a name="sysrequirements">System Requirements</a></h2>
  111. <p>
  112. To build and use Ant, you must have a JAXP-compliant XML parser installed and available on your classpath.
  113. <p>
  114. Both the binary and source distributions of Ant include the reference implementation of JAXP 1.0.
  115. Please see <a href="http://java.sun.com/xml/">http://java.sun.com/xml/</a> for more information.
  116. If you wish to use a different JAXP-compliant parser, you should remove
  117. <code>jaxp.jar</code> and <code>parser.jar</code>
  118. from Ant's <code>lib/core</code> directory.
  119. You can then either put the jars from your preferred parser into Ant's
  120. <code>lib/core</code> directory or put the jars on the system classpath.
  121. <p>
  122. For the current version of Ant, you will also need a JDK installed on
  123. your system, version 1.1 or later. A future version of Ant will require
  124. JDK 1.2 or later.
  125. </p>
  126. <hr>
  127. <h2><a name="installing">Installing Ant</a></h2>
  128. <p>The binary distribution of Ant consists of four directories:
  129. <code>bin</code>,
  130. <code>docs</code>,
  131. <code>lib</code> and
  132. <code>src</code>. Only the <code>bin</code>
  133. and <code>lib</code> directories are required for running Ant. To run Ant, the
  134. following must be done:</p>
  135. <ul>
  136. <li>Add the <code>bin</code> directory to your path.</li>
  137. <li>Set the <code>ANT_HOME</code> environment variable.
  138. This should be set to the directory
  139. that contains the <code>bin</code> and <code>lib</code> directories.</li>
  140. <li>(Optionally) Set the <code>JAVA_HOME</code> environment variable.
  141. (See the <a href="#advanced">Advanced</a> section below.)
  142. This should be set to the directory where the JDK is installed.</li>
  143. </ul>
  144. <h3>Windows</h3>
  145. <p>Assume Ant is installed in <code>c:\ant\</code>. The following sets up the
  146. environment:</p>
  147. <pre>set ANT_HOME=c:\ant
  148. set JAVA_HOME=c:\jdk1.2.2
  149. set PATH=%PATH%;%ANT_HOME%\bin</pre>
  150. <h3>Unix (bash)</h3>
  151. <p>Assume Ant is installed in <code>/usr/local/ant</code>. The following sets up
  152. the environment:</p>
  153. <pre>export ANT_HOME=/usr/local/ant
  154. export JAVA_HOME=/usr/local/jdk-1.2.2
  155. export PATH=${PATH}:${ANT_HOME}/bin</pre>
  156. <a name="advanced">
  157. <h3>Advanced</h3>
  158. </a>
  159. <p>There are lots of variants that can be used to run Ant. What you need is at
  160. least the following:</p>
  161. <blockquote>
  162. The classpath for Ant must contain <code>ant.jar</code> and any jars/classes
  163. needed for your chosen JAXP-compliant XML parser.</p>
  164. <p>When you need JDK functionality
  165. (such as for the <a href="#javac">javac</a> task or the
  166. <a href="#rmic">rmic</a> task), then for JDK 1.1, the <code>classes.zip</code>
  167. file of the JDK must be added to the classpath; for JDK 1.2 or JDK 1.3, <code>tools.jar</code>
  168. must be added. The scripts supplied with Ant,
  169. in the <code>bin</code> directory, will add
  170. the required JDK classes automatically, if the <code>JAVA_HOME</code>
  171. environment variable is set.</p>
  172. <p>When you are executing platform-specific applications (such as the <a
  173. href="#exec">exec</a> task or the <a href="#cvs">cvs</a> task), the property <code>ant.home</code>
  174. must be set to the directory containing
  175. the <code>antRun</code> shell script necessary to run exec's on Unix.</p>
  176. </blockquote>
  177. <hr>
  178. <h2><a name="buildingant">Building Ant</a></h2>
  179. <p>To build Ant, you should install the Ant source distribution.
  180. While the binary distribution
  181. includes the Ant source code, it is intended for reference purposes only.
  182. The bootstrap and build scripts used to build Ant itself are not included
  183. in the binary distribution.
  184. <p>
  185. <p>Once you have installed the source distribution, go to the
  186. <code>jakarta-ant</code> directory.</p>
  187. <p>Set the <code>JAVA_HOME</code> environment variable
  188. to the directory where the JDK is installed.
  189. See <a href="#installing">Installing Ant</a>
  190. for examples on how to do this for your operating system. </p>
  191. <p>Make sure you have downloaded any auxilliary jars required to
  192. build tasks you are interested in. These should either be available
  193. on the classpath or added to Ant's <code>lib</code>
  194. directory. The list of auxilliary tasks and requirements is in
  195. <code>lib/README</code>.</p>
  196. <p>Run <code>bootstrap.bat</code> (Windows) or <code>bootstrap.sh</code> (UNIX)
  197. to build a bootstrap version of Ant.</p>
  198. <p>When finished, use:</p>
  199. <blockquote>
  200. <p><code>build -Ddist.dir=&lt;<i>directory_to_contain_Ant_distribution</i>&gt; dist</code>&nbsp;&nbsp;&nbsp;&nbsp;(<i>Windows</i>)</p>
  201. <p><code>build.sh -Ddist.dir=&lt;<i>directory_to_contain_Ant_distribution</i>&gt; dist</code>&nbsp;&nbsp;&nbsp;&nbsp;(<i>Unix</i>)</p>
  202. </blockquote>
  203. <p>to create a binary distribution of Ant. This distribution can be
  204. found in the directory you specified.</p>
  205. If you wish to install the build into the current <code>ANT_HOME</code>
  206. directory, you can use:
  207. <blockquote>
  208. <p><code>build install</code>&nbsp;&nbsp;&nbsp;&nbsp;(<i>Windows</i>)</p>
  209. <p><code>build.sh install</code>&nbsp;&nbsp;&nbsp;&nbsp;(<i>Unix</i>)</p>
  210. </blockquote>
  211. You can avoid the lengthy Javadoc step, if desired, with:
  212. <blockquote>
  213. <p><code>build mininstall</code>&nbsp;&nbsp;&nbsp;&nbsp;(<i>Windows</i>)</p>
  214. <p><code>build.sh mininstall</code>&nbsp;&nbsp;&nbsp;&nbsp;(<i>Unix</i>)</p>
  215. </blockquote>
  216. This will only install the <code>bin</code> and <code>lib</code> directories.
  217. <p>Both the <code>install</code> and
  218. <code>mininstall</code> targets will overwrite
  219. the current Ant version in <code>ANT_HOME</code>.
  220. <hr>
  221. <h2><a name="running">Running Ant</a></h2>
  222. <p>Running Ant is simple, when you installed it as described in the previous
  223. section. Just type <code>ant</code>.</p>
  224. <p>When nothing is specified, Ant looks for a <code>build.xml</code>
  225. file in the current directory. If found, it uses that file as the
  226. buildfile. If you use the <nobr><code>-find</code></nobr> option,
  227. Ant will search for a buildfile in
  228. the parent directory, and so on, until the root of the filesystem
  229. has been reached. To make Ant use
  230. another buildfile, use the command-line
  231. option <code>-buildfile <i>file</i></code>,
  232. where <i>file</i> is the buildfile you want to use.</p>
  233. <p>You can also set properties that override properties specified in the
  234. buildfile (see the <a href="#property">property</a> task).
  235. This can be done with
  236. the <nobr><code>-D<i>property</i>=<i>value</i></code></nobr> option,
  237. where <i>property</i> is the name of the property,
  238. and <i>value</i> is the value for that property.
  239. This can also be used to have access to your environment variables
  240. (and is the only way, since Java cannot access them).
  241. Just pass <nobr><code>-DMYVAR=%MYVAR%</code></nobr> (Windows) or
  242. <nobr><code>-DMYVAR=$MYVAR</code></nobr> (Unix)
  243. to Ant &#150; you can then access
  244. these variables inside your buildfile as <code>${MYVAR}</code>.</p>
  245. <p>Two more options are: <nobr><code>-quiet</code></nobr>,
  246. which instructs Ant to print less
  247. information on the console when running, and
  248. <nobr><code>-verbose</code></nobr>, which causes Ant to print
  249. additional information to the console.</p>
  250. <p>It is also possible to specify one or more targets that should be executed.
  251. When omitted, the target that is specified in the
  252. <code>default</code> attribute of the <code>&lt;project&gt;</code> tag is
  253. used.</p>
  254. <p>The <nobr><code>-projecthelp</code></nobr>
  255. option gives a list of this project's
  256. targets. First those with a description, then those without one.</p>
  257. <p>Command-line option summary:</p>
  258. <pre>ant [options] [target [target2 [target3] ...]]
  259. Options:
  260. -help print this message
  261. -projecthelp print project help information
  262. -version print the version information and exit
  263. -quiet be extra quiet
  264. -verbose be extra verbose
  265. -debug print debugging information
  266. -emacs produce logging information without adornments
  267. -logfile <i>file</i> use given file for log output
  268. -logger <i>classname</i> the class that is to perform logging
  269. -listener <i>classname</i> add an instance of class as a project listener
  270. -buildfile <i>file</i> use specified buildfile
  271. -find <i>file</i> search for buildfile towards the root of the filesystem and use the first one found
  272. -D<i>property</i>=<i>value</i> set <i>property</i> to <i>value</i>
  273. </pre>
  274. <h3>Examples</h3>
  275. <blockquote>
  276. <pre>ant</pre>
  277. </blockquote>
  278. <p>runs Ant using the <code>build.xml</code> file in the current directory, on
  279. the default target.</p>
  280. <blockquote>
  281. <pre>ant -buildfile test.xml</pre>
  282. </blockquote>
  283. <p>runs Ant using the <code>test.xml</code> file in the current directory, on
  284. the default target.</p>
  285. <blockquote>
  286. <pre>ant -buildfile test.xml dist</pre>
  287. </blockquote>
  288. <p>runs Ant using the <code>test.xml</code> file in the current directory, on a
  289. target called <code>dist</code>.</p>
  290. <blockquote>
  291. <pre>ant -buildfile test.xml -Dbuild=build/classes dist</pre>
  292. </blockquote>
  293. <p>runs Ant using the <code>test.xml</code> file in the current directory, on a
  294. target called <code>dist</code>, setting the <code>build</code> property to the
  295. value <code>build/classes</code>.</p>
  296. <h3>Running Ant by Hand</h3>
  297. <p>If you have installed Ant in the do-it-yourself way, Ant can be started
  298. with:</p>
  299. <blockquote>
  300. <pre>java -Dant.home=c:\ant org.apache.tools.ant.Main [options] [target]</pre>
  301. </blockquote>
  302. <p>These instructions actually do exactly the same as the <code>ant</code>
  303. command. The options and target are the same as when running Ant with the <code>ant</code>
  304. command. This example assumes you have set your classpath to include:
  305. <ul>
  306. <li><code>ant.jar</code>
  307. <li>jars/classes for your XML parser
  308. <li>the JDK's required jar/zip files
  309. </ul>
  310. <hr>
  311. <h2><a name="buildfile">Writing a Simple Buildfile</a></h2>
  312. <p>Ant's buildfiles are written in XML. Each buildfile contains one project.</p>
  313. <p>Each task element of the buildfile can have an <code>id</code> attribute and
  314. can later be referred to by the value supplied to this. The value has
  315. to be unique. (For additional information, see the
  316. <a href="#tasks"> Tasks</a> section below.)</p>
  317. <h3>Projects</h3>
  318. <p>A <i>project</i> has three attributes:</p>
  319. <table border="1" cellpadding="2" cellspacing="0">
  320. <tr>
  321. <td valign="top"><b>Attribute</b></td>
  322. <td valign="top"><b>Description</b></td>
  323. <td align="center" valign="top"><b>Required</b></td>
  324. </tr>
  325. <tr>
  326. <td valign="top">name</td>
  327. <td valign="top">the name of the project.</td>
  328. <td align="center" valign="top">No</td>
  329. </tr>
  330. <tr>
  331. <td valign="top">default</td>
  332. <td valign="top">the default target to use when no target is supplied.</td>
  333. <td align="center" valign="top">Yes</td>
  334. </tr>
  335. <tr>
  336. <td valign="top">basedir</td>
  337. <td valign="top">the base directory from which all path calculations are
  338. done. This attribute might be overridden by setting
  339. the &quot;basedir&quot;
  340. property beforehand. When this is done, it must be omitted in the
  341. project tag. If neither the attribute nor the property have
  342. been set, the parent directory of the buildfile will be used.</td>
  343. <td align="center" valign="top">No</td>
  344. </tr>
  345. </table>
  346. <p>Each project defines one or more <i>targets</i>.
  347. A target is a set of <i>tasks</i> you want
  348. to be executed. When starting Ant, you can select which target(s) you
  349. want to have executed. When no target is given,
  350. the project's default is used.</p>
  351. <h3>Targets</h3>
  352. <p>A target can depend on other targets. You might have a target for compiling,
  353. for example, and a target for creating a distributable. You can only build a
  354. distributable when you have compiled first, so the distribute target
  355. <i>depends on</i> the compile target. Ant resolves these dependencies.</p>
  356. <p>It should be noted, however, that Ant's <code>depends</code> attribute
  357. only specifies the <i>order</i> in which targets should be executed &#150; it
  358. does not affect whether the target that specifies the dependency(s) gets
  359. executed if the dependent target(s) did not (need to) run.
  360. </p>
  361. <p>Ant tries to execute the targets in the <code>depends</code>
  362. attribute in the order
  363. they appear (from left to right). Keep in mind that it is possible that a target
  364. can get executed earlier when an earlier target depends on it:</p>
  365. <blockquote>
  366. <pre>&lt;target name=&quot;A&quot;/&gt;
  367. &lt;target name=&quot;B&quot; depends=&quot;A&quot;/&gt;
  368. &lt;target name=&quot;C&quot; depends=&quot;B&quot;/&gt;
  369. &lt;target name=&quot;D&quot; depends=&quot;C,B,A&quot;/&gt;</pre>
  370. </blockquote>
  371. <p>Suppose we want to execute target D. From its
  372. <code>depends</code> attribute, you
  373. might think that first target C, then B and then A is executed.
  374. Wrong! C depends on B, and B depends on A, so first A is executed, then B, then C, and finally D.</p>
  375. <p>A target gets executed only once, even when more than one target
  376. depends on it (see the previous example).</p>
  377. <p>A target also has the ability to perform its execution if (or
  378. unless) a property has been set. This allows, for example, better
  379. control on the building process depending on the state of the system
  380. (java version, OS, command-line property defines, etc.). To make a target
  381. <i>sense</i> this property, you should add the <code>if</code> (or
  382. <code>unless</code>) attribute with the name of the property that the target
  383. should react to. For example:</p>
  384. <blockquote>
  385. <pre>&lt;target name=&quot;build-module-A&quot; if=&quot;module-A-present&quot;/&gt;</pre>
  386. <pre>&lt;target name=&quot;build-own-fake-module-A&quot; unless=&quot;module-A-present&quot;/&gt;</pre>
  387. </blockquote>
  388. <p>If no <code>if</code> and no <code>unless</code> attribute is present,
  389. the target will always be executed.</p>
  390. <p>The optional <code>description</code> attribute can be used to provide a one-line description of this target, which is printed by the
  391. <nobr><code>-projecthelp</code></nobr> command-line option.</p>
  392. <p>It is a good practice to place your <a
  393. href="#tstamp">tstamp</a> tasks in a so-called
  394. <i>initialization</i> target, on which
  395. all other targets depend. Make sure that target is always the first one in
  396. the depends list of the other targets. In this manual, most initialization targets
  397. have the name &quot;init&quot;.</p>
  398. <p>A target has the following attributes:</p>
  399. <table border="1" cellpadding="2" cellspacing="0">
  400. <tr>
  401. <td valign="top"><b>Attribute</b></td>
  402. <td valign="top"><b>Description</b></td>
  403. <td align="center" valign="top"><b>Required</b></td>
  404. </tr>
  405. <tr>
  406. <td valign="top">name</td>
  407. <td valign="top">the name of the target.</td>
  408. <td align="center" valign="top">Yes</td>
  409. </tr>
  410. <tr>
  411. <td valign="top">depends</td>
  412. <td valign="top">a comma-separated list of names of targets on which this
  413. target depends.</td>
  414. <td align="center" valign="top">No</td>
  415. </tr>
  416. <tr>
  417. <td valign="top">if</td>
  418. <td valign="top">the name of the property that must be set in order for this
  419. target to execute.</td>
  420. <td align="center" valign="top">No</td>
  421. </tr>
  422. <tr>
  423. <td valign="top">unless</td>
  424. <td valign="top">the name of the property that must not be set in order
  425. for this target to execute.</td>
  426. <td align="center" valign="top">No</td>
  427. </tr>
  428. <tr>
  429. <td valign="top">description</td>
  430. <td valign="top">a short description of this target's function.</td>
  431. <td align="center" valign="top">No</td>
  432. </tr>
  433. </table>
  434. <a name="tasks">
  435. <h3>Tasks</h3>
  436. </a>
  437. <p>A task is a piece of code that can be executed.</p>
  438. <p>A task can have multiple attributes (or arguments, if you prefer). The value
  439. of an attribute might contain references to a property. These references will be
  440. resolved before the task is executed.</p>
  441. <p>Tasks have a common structure:</p>
  442. <blockquote>
  443. <pre>&lt;<i>name</i> <i>attribute1</i>=&quot;<i>value1</i>&quot; <i>attribute2</i>=&quot;<i>value2</i>&quot; ... /&gt;</pre>
  444. </blockquote>
  445. <p>where <i>name</i> is the name of the task,
  446. <i>attributeN</i> is the attribute name, and
  447. <i>valueN</i> is the value for this attribute.</p>
  448. <p>There is a set of <a href="#bitasks">built-in tasks</a>, along with a
  449. number of
  450. <a href="#optionaltasks"> optional tasks</a>, but it is also very
  451. easy to <a href="#writingowntask">write your own</a>.</p>
  452. <p>All tasks share a task name attribute. The value of
  453. this attribute will be used in the logging messages generated by
  454. Ant.</p>
  455. Tasks can be assigned an <code>id</code> attribute:
  456. <blockquote>
  457. <pre>&lt;<i>taskname</i> id="<i>taskID</i>" ... /&gt;</pre>
  458. </blockquote>
  459. where <i>taskname</i> is the name of the task, and <i>taskID</i> is
  460. a unique name for this task.
  461. You can refer to the
  462. corresponding task object in scripts or other tasks via this name.
  463. For example, in scripts you could do:
  464. <blockquote>
  465. <pre>
  466. &lt;script ... &gt;
  467. task1.setFoo("bar");
  468. &lt;/script&gt;
  469. </pre>
  470. </blockquote>
  471. to set the <code>foo</code> attribute of this particular task instance.
  472. In another task (written in Java), you can access the instance via
  473. <code>project.getReference("task1")</code>.
  474. <p>
  475. Note<sup>1</sup>: If "task1" has not been run yet, then
  476. it has not been configured (ie., no attributes have been set), and if it is
  477. going to be configured later, anything you've done to the instance may
  478. be overwritten.
  479. </p>
  480. <p>
  481. Note<sup>2</sup>: Future versions of Ant will most likely <i>not</i>
  482. be backward-compatible with this behaviour, since there will likely be no
  483. task instances at all, only proxies.
  484. </p>
  485. <h3>Properties</h3>
  486. <p>A project can have a set of properties. These might be set in the buildfile
  487. by the <a href="#property">property task</a>, or might be set outside Ant. A
  488. property has a name and a value. Properties may be used in the value of
  489. task attributes. This is done by placing the property name between
  490. &quot;<code>${</code>&quot; and &quot;<code>}</code>&quot; in the
  491. attribute value. For example,
  492. if there is a &quot;builddir&quot; property with the value
  493. &quot;build&quot;, then this could be used in an attribute like this:
  494. <code>${builddir}/classes</code>.
  495. This is resolved as <code>build/classes</code>.</p>
  496. <h3>Built-in Properties</h3>
  497. <p>Ant provides access to all system properties as if they had been
  498. defined using a <code>&lt;property&gt;</code> task.
  499. For example, <code>${os.name}</code> expands to the
  500. name of the operating system.</p>
  501. <p>In addition, Ant has some built-in properties:</p>
  502. <pre>
  503. basedir the absolute path of the project's basedir (as set
  504. with the basedir attribute of &lt;project&gt;).
  505. ant.file the absolute path of the buildfile.
  506. ant.project.name the name of the project that is currently executing;
  507. it is set in the name attribute of &lt;project&gt;.
  508. ant.java.version the JVM version Ant detected; currently it can hold
  509. the values &quot;1.1&quot;, &quot;1.2&quot; and &quot;1.3&quot;.
  510. </pre>
  511. <h3>Example</h3>
  512. <pre>
  513. &lt;project name=&quot;MyProject&quot; default=&quot;dist&quot; basedir=&quot;.&quot;&gt;
  514. &lt;!-- set global properties for this build --&gt;
  515. &lt;property name=&quot;src&quot; value=&quot;.&quot;/&gt;
  516. &lt;property name=&quot;build&quot; value=&quot;build&quot;/&gt;
  517. &lt;property name=&quot;dist&quot; value=&quot;dist&quot;/&gt;
  518. &lt;target name=&quot;init&quot;&gt;
  519. &lt;!-- Create the time stamp --&gt;
  520. &lt;tstamp/&gt;
  521. &lt;!-- Create the build directory structure used by compile --&gt;
  522. &lt;mkdir dir=&quot;${build}&quot;/&gt;
  523. &lt;/target&gt;
  524. &lt;target name=&quot;compile&quot; depends=&quot;init&quot;&gt;
  525. &lt;!-- Compile the java code from ${src} into ${build} --&gt;
  526. &lt;javac srcdir=&quot;${src}&quot; destdir=&quot;${build}&quot;/&gt;
  527. &lt;/target&gt;
  528. &lt;target name=&quot;dist&quot; depends=&quot;compile&quot;&gt;
  529. &lt;!-- Create the distribution directory --&gt;
  530. &lt;mkdir dir=&quot;${dist}/lib&quot;/&gt;
  531. &lt;!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file --&gt;
  532. &lt;jar jarfile=&quot;${dist}/lib/MyProject-${DSTAMP}.jar&quot; basedir=&quot;${build}&quot;/&gt;
  533. &lt;/target&gt;
  534. &lt;target name=&quot;clean&quot;&gt;
  535. &lt;!-- Delete the ${build} and ${dist} directory trees --&gt;
  536. &lt;delete dir=&quot;${build}&quot;/&gt;
  537. &lt;delete dir=&quot;${dist}&quot;/&gt;
  538. &lt;/target&gt;
  539. &lt;/project&gt;
  540. </pre>
  541. <h3>Token Filters</h3>
  542. <p>A project can have a set of tokens that might be automatically expanded if
  543. found when a file is copied, when the filtering-copy behavior is selected in the
  544. tasks that support this. These might be set in the buildfile
  545. by the <a href="#filter">filter task</a>.&nbsp;</p>
  546. <p>Since this can potentially be a very harmful behavior,
  547. the tokens in the files <b>must</b>
  548. be of the form <code>@</code><i>token</i><code>@</code>, where
  549. <i>token</i> is the token name that is set
  550. in the filter task. This token syntax matches the syntax of other build systems
  551. that perform such filtering and remains sufficiently orthogonal to most
  552. programming and scripting languages, as well as with documentation systems.</p>
  553. <p>Note: If a token with the format <code>@</code><i>token</i><code>@</code>
  554. is found in a file, but no
  555. filter is associated with that token, no changes take place;
  556. therefore, no escaping
  557. method is available &#150; but as long as you choose appropriate names for your
  558. tokens, this should not cause problems.</p>
  559. <h3><a name="path">Path-like Structures</a></h3>
  560. <p>You can specify <code>PATH</code>- and <code>CLASSPATH</code>-type
  561. references using both
  562. &quot;<code>:</code>&quot; and &quot;<code>;</code>&quot; as separator
  563. characters. Ant will
  564. convert the separator to the correct character of the current operating
  565. system.</p>
  566. <p>Wherever path-like values need to be specified, a nested element can
  567. be used. This takes the general form of:</p>
  568. <pre>
  569. &lt;classpath&gt;
  570. &lt;pathelement path=&quot;${classpath}&quot;/&gt;
  571. &lt;pathelement location=&quot;lib/helper.jar&quot;/&gt;
  572. &lt;/classpath&gt;
  573. </pre>
  574. <p>The <code>location</code> attribute specifies a single file or
  575. directory relative to the project's base directory (or an absolute
  576. filename), while the <code>path</code> attribute accepts colon-
  577. or semicolon-separated lists of locations. The <code>path</code>
  578. attribute is intended to be used with predefined paths &#150; in any other
  579. case, multiple elements with <code>location</code> attributes should be
  580. preferred.</p>
  581. <p>As a shortcut, the <code>&lt;classpath&gt;</code> tag
  582. supports <code>path</code> and
  583. <code>location</code> attributes of its own, so:</p>
  584. <pre>
  585. &lt;classpath&gt;
  586. &lt;pathelement path=&quot;${classpath}&quot;/&gt;
  587. &lt;/classpath&gt;
  588. </pre>
  589. <p>can be abreviated to:</p>
  590. <pre>
  591. &lt;classpath path=&quot;${classpath}&quot;/&gt;
  592. </pre>
  593. <p>In addition, <a href="#fileset">FileSet</a>s can be specified via
  594. nested <code>&lt;fileset&gt;</code> elements. The order in which the files
  595. building up a fileset are added to the path-like structure is not
  596. defined.</p>
  597. <pre>
  598. &lt;classpath&gt;
  599. &lt;pathelement path=&quot;${classpath}&quot;/&gt;
  600. &lt;fileset dir=&quot;lib&quot;&gt;
  601. &lt;include name=&quot;**/*.jar&quot;/&gt;
  602. &lt;/fileset&gt;
  603. &lt;pathelement location=&quot;classes&quot;/&gt;
  604. &lt;/classpath&gt;
  605. </pre>
  606. <p>Builds a path that holds the value of <code>${classpath}</code>,
  607. followed by all jar files in the <code>lib</code> directory, followed
  608. by the <code>classes</code> directory.</p>
  609. <p>If you want to use the same path-like structure for several tasks,
  610. you can define them with a <code>&lt;path&gt;</code> element at the
  611. same level as <i>target</i>s, and reference them via their
  612. <i>id</i> attribute &#150; see <a href="#references">References</a> for an
  613. example.</p>
  614. <p>A path-like structure can include a reference to another path-like
  615. structure via nested <code>&lt;path&gt;</code> elements:</p>
  616. <pre>
  617. &lt;path id=&quot;base.path&quot;&gt;
  618. &lt;pathelement path=&quot;${classpath}&quot;/&gt;
  619. &lt;fileset dir=&quot;lib&quot;&gt;
  620. &lt;include name=&quot;**/*.jar&quot;/&gt;
  621. &lt;/fileset&gt;
  622. &lt;pathelement location=&quot;classes&quot;/&gt;
  623. &lt;/path&gt;
  624. &lt;path id=&quot;tests.path&quot;&gt;
  625. &lt;path refid=&quot;base.path&quot;/&gt;
  626. &lt;pathelement location=&quot;testclasses&quot;/&gt;
  627. &lt;/path&gt;
  628. </pre>
  629. The shortcuts previously mentioned for <code>&lt;classpath&gt;</code> are also valid for <code>&lt;path&gt;</code>.For example:
  630. <pre>
  631. &lt;path id=&quot;base.path&quot;&gt;
  632. &lt;pathelement path=&quot;${classpath}&quot;/&gt;
  633. &lt;/path&gt;
  634. </pre>
  635. can be written as:
  636. <pre>
  637. &lt;path id=&quot;base.path&quot; path=&quot;${classpath}&quot;/&gt;
  638. </pre>
  639. <h3><a name="arg">Command-line Arguments</a></h3>
  640. <p>Several tasks take arguments that will be passed to another
  641. process on the command line. To make it easier to specify arguments
  642. that contain space characters, nested <code>arg</code> elements can be used.</p>
  643. <table border="1" cellpadding="2" cellspacing="0">
  644. <tr>
  645. <td width="12%" valign="top"><b>Attribute</b></td>
  646. <td width="78%" valign="top"><b>Description</b></td>
  647. <td width="10%" valign="top"><b>Required</b></td>
  648. </tr>
  649. <tr>
  650. <td valign="top">value</td>
  651. <td valign="top">a single command-line argument; can contain space
  652. characters.</td>
  653. <td align="center" rowspan="4">Exactly one of these.</td>
  654. </tr>
  655. <tr>
  656. <td valign="top">line</td>
  657. <td valign="top">a space-delimited list of command-line arguments.</td>
  658. </tr>
  659. <tr>
  660. <td valign="top">file</td>
  661. <td valign="top">The name of a file as a single command-line
  662. argument; will be replaced with the absolute filename of the file.</td>
  663. </tr>
  664. <tr>
  665. <td valign="top">path</td>
  666. <td valign="top">A string that will be treated as a path-like
  667. string as a single command-line argument; you can use <code>;</code>
  668. or <code>:</code> as
  669. path separators and Ant will convert it to the platform's local
  670. conventions.</td>
  671. </tr>
  672. </table>
  673. <h4>Examples</h4>
  674. <blockquote><pre>
  675. &lt;arg value=&quot;-l -a&quot;/&gt;
  676. </pre></blockquote>
  677. <p>is a single command-line argument containing a space character.</p>
  678. <blockquote><pre>
  679. &lt;arg line=&quot;-l -a&quot;/&gt;
  680. </pre></blockquote>
  681. <p>represents two separate command-line arguments.</p>
  682. <blockquote><pre>
  683. &lt;arg path=&quot;/dir;/dir2:\dir3&quot;/&gt;
  684. </pre></blockquote>
  685. <p>is a single command-line argument with the value
  686. <code>\dir;\dir2;\dir3</code> on DOS-based systems and
  687. <code>/dir:/dir2:/dir3</code> on Unix-like systems.</p>
  688. <h3><a name="references">References</a></h3>
  689. <p>The <code>id</code> attribute of the buildfile's elements can be
  690. used to refer to them. This can useful if you are going to replicate
  691. the same snippet of XML over and over again &#150; using a
  692. <code>&lt;classpath&gt;</code> structure more than once for
  693. example.</p>
  694. <p>The following example:</p>
  695. <blockquote><pre>
  696. &lt;project ... &gt;
  697. &lt;target ... &gt;
  698. &lt;rmic ...&gt;
  699. &lt;classpath&gt;
  700. &lt;pathelement location=&quot;lib/&quot;/&gt;
  701. &lt;pathelement path=&quot;${java.class.path}/&quot;/&gt;
  702. &lt;pathelement path=&quot;${additional.path}&quot;/&gt;
  703. &lt;/classpath&gt;
  704. &lt;/rmic&gt;
  705. &lt;/target&gt;
  706. &lt;target ... &gt;
  707. &lt;javac ...&gt;
  708. &lt;classpath&gt;
  709. &lt;pathelement location=&quot;lib/&quot;/&gt;
  710. &lt;pathelement path=&quot;${java.class.path}/&quot;/&gt;
  711. &lt;pathelement path=&quot;${additional.path}&quot;/&gt;
  712. &lt;/classpath&gt;
  713. &lt;/javac&gt;
  714. &lt;/target&gt;
  715. &lt;/project&gt;
  716. </pre></blockquote>
  717. <p>could be rewritten as:</p>
  718. <blockquote><pre>
  719. &lt;project ... &gt;
  720. &lt;path id=&quot;project.class.path&quot;&gt;
  721. &lt;pathelement location=&quot;lib/&quot;/&gt;
  722. &lt;pathelement path=&quot;${java.class.path}/&quot;/&gt;
  723. &lt;pathelement path=&quot;${additional.path}&quot;/&gt;
  724. &lt;/path&gt;
  725. &lt;target ... &gt;
  726. &lt;rmic ...&gt;
  727. &lt;classpath refid=&quot;project.class.path&quot;/&gt;
  728. &lt;/rmic&gt;
  729. &lt;/target&gt;
  730. &lt;target ... &gt;
  731. &lt;javac ...&gt;
  732. &lt;classpath refid=&quot;project.class.path&quot;/&gt;
  733. &lt;/javac&gt;
  734. &lt;/target&gt;
  735. &lt;/project&gt;
  736. </pre></blockquote>
  737. <p>All tasks that use nested elements for <a
  738. href="#patternset">PatternSet</a>s, <a href="#fileset">FileSet</a>s or
  739. <a href="#path">path-like structures</a> accept references to these
  740. structures as well.</p>
  741. <hr>
  742. <h2><a name="directorybasedtasks">Directory-based Tasks</a></h2>
  743. <p>Some tasks use directory trees for the task they perform.
  744. For example, the <a
  745. href="#javac">javac</a> task, which works upon a directory tree
  746. with <code>.java</code> files.
  747. Sometimes it can be very useful to work on a subset of that directory tree. This
  748. section describes how you can select a subset of such a directory tree.</p>
  749. <p>Ant gives you two ways to create a subset, both of which can be used at the same
  750. time:</p>
  751. <ul>
  752. <li>Only include files/directories that match at least one pattern of a set of
  753. patterns.</li>
  754. <li>Exclude files/directories that match at least one pattern a set of
  755. patterns.</li>
  756. </ul>
  757. <p>When both inclusion and exclusion are used, only files/directories that match
  758. the include patterns, and don't match the exclude patterns, are used.</p>
  759. <p>Patterns can be specified inside the buildfile via task attributes or
  760. nested elements and via external files. Each line of the external file
  761. is taken as a pattern that is added to the list of include or exclude
  762. patterns.</p>
  763. <h3>Patterns</h3>
  764. <p>As described earlier, patterns are used for the inclusion and exclusion.
  765. These patterns look very much like the patterns used in DOS and UNIX:</p>
  766. <p>'*' matches zero or more characters, '?' matches one character.</p>
  767. <p><b>Examples:</b></p>
  768. <p>
  769. <code>*.java</code>&nbsp;&nbsp;matches&nbsp;&nbsp;<code>.java</code>,
  770. <code>x.java</code> and <code>FooBar.java</code>, but
  771. not <code>FooBar.xml</code> (does not end with <code>.java</code>).</p>
  772. <p>
  773. <code>?.java</code>&nbsp;&nbsp;matches&nbsp;&nbsp;<code>x.java</code>,
  774. <code>A.java</code>, but not <code>.java</code> or <code>xyz.java</code>
  775. (both don't have one character before <code>.java</code>).</p>
  776. <p>
  777. Combinations of <code>*</code>'s and <code>?</code>'s are allowed.</p>
  778. <p>Matching is done per-directory. This means that first the first directory in
  779. the pattern is matched against the first directory in the path to match. Then
  780. the second directory is matched, and so on. For example, when we have the pattern <code>/?abc/*/*.java</code>
  781. and the path <code>/xabc/foobar/test.java</code>,
  782. the first <code>?abc</code> is matched with <code>xabc</code>,
  783. then <code>*</code> is matched with <code>foobar</code>,
  784. and finally <code>*.java</code> is matched with <code>test.java</code>.
  785. They all match, so the path matches the pattern.</p>
  786. <p>To make things a bit more flexible, we add one extra feature, which makes it
  787. possible to match multiple directory levels. This can be used to match a
  788. complete directory tree, or a file anywhere in the directory tree.
  789. To do this, <code>**</code>
  790. must be used as the name of a directory.
  791. When <code>**</code> is used as the name of a
  792. directory in the pattern, it matches zero or more directories.
  793. For example:
  794. <code>/test/**</code> matches all files/directories under <code>/test/</code>,
  795. such as <code>/test/x.java</code>,
  796. or <code>/test/foo/bar/xyz.html</code>, but not <code>/xyz.xml</code>.</p>
  797. <p>There is one &quot;shorthand&quot; &#150; if a pattern ends
  798. with <code>/</code>
  799. or <code>\</code>, then <code>**</code>
  800. is appended.
  801. For example, <code>mypackage/test/</code> is interpreted as if it were
  802. <code>mypackage/test/**</code>.</p>
  803. <p><b>Example patterns:</b></p>
  804. <table border="1" cellpadding="2" cellspacing="0">
  805. <tr>
  806. <td valign="top"><code>**/CVS/*</code></td>
  807. <td valign="top">Matches all files in <code>CVS</code> directories that can be located
  808. anywhere in the directory tree.<br>
  809. Matches:
  810. <pre>
  811. CVS/Repository
  812. org/apache/CVS/Entries
  813. org/apache/jakarta/tools/ant/CVS/Entries
  814. </pre>
  815. But not:
  816. <pre>
  817. org/apache/CVS/foo/bar/Entries (<code>foo/bar/</code> part does not match)</td>
  818. </pre>
  819. </tr>
  820. <tr>
  821. <td valign="top"><code>org/apache/jakarta/**</code></td>
  822. <td valign="top">Matches all files in the <code>org/apache/jakarta</code> directory tree.<br>
  823. Matches:
  824. <pre>
  825. org/apache/jakarta/tools/ant/docs/index.html
  826. org/apache/jakarta/test.xml
  827. </pre>
  828. But not:
  829. <pre>
  830. org/apache/xyz.java
  831. </pre>
  832. (<code>jakarta/</code> part is missing).</td>
  833. </tr>
  834. <tr>
  835. <td valign="top"><code>org/apache/**/CVS/*</code></td>
  836. <td valign="top">Matches all files in <code>CVS</code> directories
  837. that are located anywhere in the directory tree under
  838. <code>org/apache</code>.<br>
  839. Matches:
  840. <pre>
  841. org/apache/CVS/Entries
  842. org/apache/jakarta/tools/ant/CVS/Entries
  843. </pre>
  844. But not:
  845. <pre>
  846. org/apache/CVS/foo/bar/Entries
  847. </pre>
  848. (<code>foo/bar/</code> part does not match)</td>
  849. </tr>
  850. <tr>
  851. <td valign="top"><code>**/test/**</code></td>
  852. <td valign="top">Matches all files that have a <code>test</code>
  853. element in their path, including <code>test</code> as a filename.</td>
  854. </tr>
  855. </table>
  856. <p>When these patterns are used in inclusion and exclusion, you have a powerful
  857. way to select just the files you want.</p>
  858. <h3>Examples</h3>
  859. <pre>
  860. &lt;copy todir=&quot;${dist}&quot;>
  861. &lt;fileset dir=&quot;${src}&quot;
  862. includes=&quot;**/images/*&quot;
  863. excludes=&quot;**/*.gif&quot;
  864. /&gt;
  865. &lt;/copy&gt;</pre>
  866. <p>This copies all files in directories called <code>images</code> that are
  867. located in the directory tree defined by <code>${src}</code> to the
  868. destination directory defined by <code>${dist}</code>,
  869. but excludes all <code>*.gif</code> files from the copy.</p>
  870. <p> This example can also be expressed using nested elements:
  871. <pre>
  872. &lt;copy todir=&quot;${dist}&quot;>
  873. &lt;fileset dir=&quot;${src}&quot;/&gt;
  874. &lt;include name=&quot;**/images/*&quot;/&gt;
  875. &lt;exclude name=&quot;**/*.gif&quot;/&gt;
  876. &lt;/fileset&gt;
  877. &lt;/copy&gt;
  878. </pre>
  879. <h3>Default Excludes</h3>
  880. <p>There are a set of definitions that are excluded by default from all directory-based tasks.
  881. They are:
  882. <pre>
  883. **/*~
  884. **/#*#
  885. **/%*%
  886. **/CVS
  887. **/CVS/**
  888. **/.cvsignore
  889. </pre>
  890. If you do not want these default excludes applied, you may disable them with the
  891. <code>defaultexcludes=&quot;no&quot;</code> attribute.
  892. <h3><a name="patternset">PatternSets</a></h3>
  893. <p>Patterns can be grouped to sets and later be referenced by their
  894. <code>id</code>
  895. attribute. They are defined via a <code>patternset</code> element,
  896. which can appear nested into a <a href="#fileset">FileSet</a> or a
  897. directory-based task that constitutes an implicit FileSet. In addition,
  898. <code>patternset</code>s can be defined at the same level as
  899. <code>target</code> &#151; i.e., as children of <code>project</code>.</p>
  900. <p>Patterns can be specified by nested <code>&lt;include&gt;</code> or
  901. <code>&lt;exclude&gt;</code> elements or the following attributes.</p>
  902. <table border="1" cellpadding="2" cellspacing="0">
  903. <tr>
  904. <td valign="top"><b>Attribute</b></td>
  905. <td valign="top"><b>Description</b></td>
  906. </tr>
  907. <tr>
  908. <td valign="top">includes</td>
  909. <td valign="top">comma-separated list of patterns of files that must be
  910. included. All files are included when omitted.</td>
  911. </tr>
  912. <tr>
  913. <td valign="top">includesfile</td>
  914. <td valign="top">the name of a file; each line of this file is
  915. taken to be an include pattern.</td>
  916. </tr>
  917. <tr>
  918. <td valign="top">excludes</td>
  919. <td valign="top">comma-separated list of patterns of files that must be
  920. excluded; no files (except default excludes) are excluded when omitted.</td>
  921. </tr>
  922. <tr>
  923. <td valign="top">excludesfile</td>
  924. <td valign="top">the name of a file; each line of this file is
  925. taken to be an exclude pattern.</td>
  926. </tr>
  927. </table>
  928. <h4>Examples</h4>
  929. <blockquote><pre>
  930. &lt;patternset id=&quot;non.test.sources&quot; &gt;
  931. &lt;include name=&quot;**/*.java&quot;/&gt;
  932. &lt;exclude name=&quot;**/*Test*&quot;/&gt;
  933. &lt;/patternset&gt;
  934. </pre></blockquote>
  935. <p>Builds a set of patterns that matches all <code>.java</code> files
  936. that do not contain the text <code>Test</code> in their name. This set
  937. can be <a href="#references">referred</a> to via
  938. <code>&lt;patternset refid=&quot;non.test.sources&quot;/&gt;</code>,
  939. by tasks that support this feature, or by FileSets.</p>
  940. <p>Note that while the <code>includes</code> and
  941. <code>excludes</code> attributes accept
  942. multiple elements separated by commas or spaces, the nested
  943. &lt;include&gt; and &lt;exclude&gt; elements expect their name
  944. attribute to hold a single pattern.</p>
  945. <p>The nested &lt;include&gt; and &lt;exclude&gt; elements allow you to use
  946. if and unless arguments to specify that the element should only be used if a
  947. property is set, or that it should be used only if a property is not set.</p>
  948. <p>For example</p>
  949. <blockquote><pre>
  950. &lt;patternset id=&quot;sources&quot; &gt;
  951. &lt;include name=&quot;std/**/*.java&quot;/&gt;
  952. &lt;include name=&quot;prof/**/*.java&quot; if=&quot;professional&quot;/&gt;
  953. &lt;exclude name=&quot;**/*Test*&quot;/&gt;
  954. &lt;/patternset&gt;
  955. </pre></blockquote>
  956. <p>will only include the files in the sub-directory <em>prof</em> if the property
  957. <em>professional</em> is set to some value.</p>
  958. <h3><a name="fileset">FileSets</a></h3>
  959. <p>FileSets are groups of files. These files can be found in a
  960. directory tree starting in a base directory and are matched by
  961. patterns taken from a number of <a
  962. href="#patternset">PatternSets</a>. FileSets can appear inside tasks
  963. that support this feature or at the same level as <code>target</code>
  964. &#150; i.e., as children of <code>project</code>.</p>
  965. <p>PatternSets can be specified as nested
  966. <code>&lt;patternset&gt;</code>
  967. elements. In addition, FileSet holds an implicit PatternSet and
  968. supports the nested <code>&lt;include&gt;</code> and
  969. <code>&lt;exclude&gt;</code> elements of PatternSet directly, as well
  970. as PatternSet's attributes.</p>
  971. <table border="1" cellpadding="2" cellspacing="0">
  972. <tr>
  973. <td valign="top"><b>Attribute</b></td>
  974. <td valign="top"><b>Description</b></td>
  975. <td align="center" valign="top"><b>Required</b></td>
  976. </tr>
  977. <tr>
  978. <td valign="top">dir</td>
  979. <td valign="top">the root of the directory tree of this FileSet.</td>
  980. <td valign="top" align="center">Yes</td>
  981. </tr>
  982. <tr>
  983. <td valign="top">defaultexcludes</td>
  984. <td valign="top">indicates whether default excludes should be used or not
  985. (<code>yes | no</code>); default excludes are used when omitted.</td>
  986. <td valign="top" align="center">No</td>
  987. </tr>
  988. <tr>
  989. <td valign="top">includes</td>
  990. <td valign="top">comma-separated list of patterns of files that must be
  991. included; all files are included when omitted.</td>
  992. <td valign="top" align="center">No</td>
  993. </tr>
  994. <tr>
  995. <td valign="top">includesfile</td>
  996. <td valign="top">the name of a file; each line of this file is
  997. taken to be an include pattern.</td>
  998. <td valign="top" align="center">No</td>
  999. </tr>
  1000. <tr>
  1001. <td valign="top">excludes</td>
  1002. <td valign="top">comma-separated list of patterns of files that must be
  1003. excluded; no files (except default excludes) are excluded when omitted.</td>
  1004. <td valign="top" align="center">No</td>
  1005. </tr>
  1006. <tr>
  1007. <td valign="top">excludesfile</td>
  1008. <td valign="top">the name of a file; each line of this file is
  1009. taken to be an exclude pattern.</td>
  1010. <td valign="top" align="center">No</td>
  1011. </tr>
  1012. </table>
  1013. <h4>Examples</h4>
  1014. <blockquote><pre>
  1015. &lt;fileset dir=&quot;${server.src}&quot; &gt;
  1016. &lt;patternset id=&quot;non.test.sources&quot; &gt;
  1017. &lt;include name=&quot;**/*.java&quot;/&gt;
  1018. &lt;exclude name=&quot;**/*Test*&quot;/&gt;
  1019. &lt;/patternset&gt;
  1020. &lt;/fileset&gt;
  1021. </pre></blockquote>
  1022. <p>Groups all files in directory <code>${server.src}</code> that are Java
  1023. source files and don't have the text <code>Test</code> in their
  1024. name.</p>
  1025. <blockquote><pre>
  1026. &lt;fileset dir=&quot;${client.src}&quot; &gt;
  1027. &lt;patternset refid=&quot;non.test.sources&quot;/&gt;
  1028. &lt;/fileset&gt;
  1029. </pre></blockquote>
  1030. <p>Groups all files in directory <code>${client.src}</code>, using the
  1031. same patterns as the example above.</p>
  1032. <h3><a name="mapper">Mapping File Names</a></h3>
  1033. <p>Some tasks take source files and create target files. Depending on
  1034. the task, it may be quite obvious which name a target file will have
  1035. (using <a href="#javac">javac</a>, you know there will be
  1036. <code>.class</code> files for your <code>.java</code> files) &#150; in
  1037. other cases you may want to specify the target files, either to help
  1038. Ant or to get an extra bit of functionality.</p>
  1039. <p>While source files are usually specified as <a
  1040. href="#fileset">fileset</a>s, you don't specify target files directly &#150;
  1041. instead, you tell Ant how to find the target file(s) for one source file. An
  1042. instance of <code>org.apache.tools.ant.util.FileNameMapper</code> is
  1043. responsible for this. It constructs target file names based on rules
  1044. that can be parameterized with <code>from</code> and <code>to</code>
  1045. attributes &#150; the exact meaning of which is implementation-dependent.</p>
  1046. <p>These instances are defined in <code>&lt;mapper&gt;</code> elements
  1047. with the following attributes:</p>
  1048. <table border="1" cellpadding="2" cellspacing="0">
  1049. <tr>
  1050. <td valign="top"><b>Attribute</b></td>
  1051. <td valign="top"><b>Description</b></td>
  1052. <td align="center" valign="top"><b>Required</b></td>
  1053. </tr>
  1054. <tr>
  1055. <td valign="top">type</td>
  1056. <td valign="top">specifies one of the built-in implementations.</td>
  1057. <td align="center" valign="center" rowspan="2">Exactly one of both</td>
  1058. </tr>
  1059. <tr>
  1060. <td valign="top">classname</td>
  1061. <td valign="top">specifies the implementation by class name.</td>
  1062. </tr>
  1063. <tr>
  1064. <td valign="top">classpath</td>
  1065. <td valign="top">the classpath to use when looking up
  1066. <code>classname</code>.</td>
  1067. <td align="center" valign="top">No</td>
  1068. </tr>
  1069. <tr>
  1070. <td valign="top">classpathref</td>
  1071. <td valign="top">the classpath to use, given as <a
  1072. href="#references">reference</a> to a path defined elsewhere.</td>
  1073. <td align="center" valign="top">No</td>
  1074. </tr>
  1075. <tr>
  1076. <td valign="top">from</td>
  1077. <td valign="top">the <code>from</code> attribute for the given
  1078. implementation.</td>
  1079. <td align="center" valign="top">Depends on implementation.</td>
  1080. </tr>
  1081. <tr>
  1082. <td valign="top">to</td>
  1083. <td valign="top">the <code>to</code> attribute for the given
  1084. implementation.</td>
  1085. <td align="center" valign="top">Depends on implementation.</td>
  1086. </tr>
  1087. </table>
  1088. <p>The classpath can be specified via a nested
  1089. <code>&lt;classpath&gt;</code>, as well &#150; that is,
  1090. a <a href="#path">path</a>-like structure.</p>
  1091. <p>The built-in mapper types are:</p>
  1092. <h4><a name="identity-mapper">identity</a></h4>
  1093. <p>The target file name is identical to the source file name. Both
  1094. <code>to</code> and <code>from</code> will be ignored.</p>
  1095. <b>Examples:</b>
  1096. <blockquote><pre>
  1097. &lt;mapper type=&quot;identity&quot;/&gt;
  1098. </pre></blockquote>
  1099. <table border="1" cellpadding="2" cellspacing="0">
  1100. <tr>
  1101. <td valign="top"><b>Source file name</b></td>
  1102. <td valign="top"><b>Target file name</b></td>
  1103. </tr>
  1104. <tr>
  1105. <td valign="top"><code>A.java</code></td>
  1106. <td valign="top"><code>A.java</code></td>
  1107. </tr>
  1108. <tr>
  1109. <td valign="top"><code>foo/bar/B.java</code></td>
  1110. <td valign="top"><code>foo/bar/B.java</code></td>
  1111. </tr>
  1112. <tr>
  1113. <td valign="top"><code>C.properties</code></td>
  1114. <td valign="top"><code>C.properties</code></td>
  1115. </tr>
  1116. <tr>
  1117. <td valign="top"><code>Classes/dir/dir2/A.properties</code></td>
  1118. <td valign="top"><code>Classes/dir/dir2/A.properties</code></td>
  1119. </tr>
  1120. </table>
  1121. <h4><a name="flatten-mapper">flatten</a></h4>
  1122. <p>The target file name is identical to the source file name, with all
  1123. leading directory information stripped off. Both <code>to</code> and
  1124. <code>from</code> will be ignored.</p>
  1125. <b>Examples:</b>
  1126. <blockquote><pre>
  1127. &lt;mapper type=&quot;flatten&quot;/&gt;
  1128. </pre></blockquote>
  1129. <table border="1" cellpadding="2" cellspacing="0">
  1130. <tr>
  1131. <td valign="top"><b>Source file name</b></td>
  1132. <td valign="top"><b>Target file name</b></td>
  1133. </tr>
  1134. <tr>
  1135. <td valign="top"><code>A.java</code></td>
  1136. <td valign="top"><code>A.java</code></td>
  1137. </tr>
  1138. <tr>
  1139. <td valign="top"><code>foo/bar/B.java</code></td>
  1140. <td valign="top"><code>B.java</code></td>
  1141. </tr>
  1142. <tr>
  1143. <td valign="top"><code>C.properties</code></td>
  1144. <td valign="top"><code>C.properties</code></td>
  1145. </tr>
  1146. <tr>
  1147. <td valign="top"><code>Classes/dir/dir2/A.properties</code></td>
  1148. <td valign="top"><code>A.properties</code></td>
  1149. </tr>
  1150. </table>
  1151. <h4><a name="merge-mapper">merge</a></h4>
  1152. <p>The target file name will always be the same, as defined by
  1153. <code>to</code> &#150; <code>from</code> will be ignored.</p>
  1154. <h5>Examples:</h5>
  1155. <blockquote><pre>
  1156. &lt;mapper type=&quot;merge&quot; to=&quot;archive.tar&quot;/&gt;
  1157. </pre></blockquote>
  1158. <table border="1" cellpadding="2" cellspacing="0">
  1159. <tr>
  1160. <td valign="top"><b>Source file name</b></td>
  1161. <td valign="top"><b>Target file name</b></td>
  1162. </tr>
  1163. <tr>
  1164. <td valign="top"><code>A.java</code></td>
  1165. <td valign="top"><code>archive.tar</code></td>
  1166. </tr>
  1167. <tr>
  1168. <td valign="top"><code>foo/bar/B.java</code></td>
  1169. <td valign="top"><code>archive.tar</code></td>
  1170. </tr>
  1171. <tr>
  1172. <td valign="top"><code>C.properties</code></td>
  1173. <td valign="top"><code>archive.tar</code></td>
  1174. </tr>
  1175. <tr>
  1176. <td valign="top"><code>Classes/dir/dir2/A.properties</code></td>
  1177. <td valign="top"><code>archive.tar</code></td>
  1178. </tr>
  1179. </table>
  1180. <h4><a name="glob-mapper">glob</a></h4>
  1181. <p>Both <code>to</code> and <code>from</code> define patterns that may
  1182. contain at most one <code>*</code>. For each source file that matches
  1183. the <code>from</code> pattern, a target file name will be constructed
  1184. from the <code>to</code> pattern by substituting the <code>*</code> in
  1185. the <code>to</code> pattern with the text that matches the
  1186. <code>*</code> in the <code>from</code> pattern. Source file names
  1187. that don't match the <code>from</code> pattern will be ignored.</p>
  1188. <b>Examples:</b>
  1189. <blockquote><pre>
  1190. &lt;mapper type=&quot;glob&quot; from=&quot;*.java&quot; to=&quot;*.java.bak&quot;/&gt;
  1191. </pre></blockquote>
  1192. <table border="1" cellpadding="2" cellspacing="0">
  1193. <tr>
  1194. <td valign="top"><b>Source file name</b></td>
  1195. <td valign="top"><b>Target file name</b></td>
  1196. </tr>
  1197. <tr>
  1198. <td valign="top"><code>A.java</code></td>
  1199. <td valign="top"><code>A.java.bak</code></td>
  1200. </tr>
  1201. <tr>
  1202. <td valign="top"><code>foo/bar/B.java</code></td>
  1203. <td valign="top"><code>foo/bar/B.java.bak</code></td>
  1204. </tr>
  1205. <tr>
  1206. <td valign="top"><code>C.properties</code></td>
  1207. <td valign="top">ignored</td>
  1208. </tr>
  1209. <tr>
  1210. <td valign="top"><code>Classes/dir/dir2/A.properties</code></td>
  1211. <td valign="top">ignored</td>
  1212. </tr>
  1213. </table>
  1214. <blockquote><pre>
  1215. &lt;mapper type=&quot;glob&quot; from=&quot;C*ies&quot; to=&quot;Q*y&quot;/&gt;
  1216. </pre></blockquote>
  1217. <table border="1" cellpadding="2" cellspacing="0">
  1218. <tr>
  1219. <td valign="top"><b>Source file name</b></td>
  1220. <td valign="top"><b>Target file name</b></td>
  1221. </tr>
  1222. <tr>
  1223. <td valign="top"><code>A.java</code></td>
  1224. <td valign="top">ignored</td>
  1225. </tr>
  1226. <tr>
  1227. <td valign="top"><code>foo/bar/B.java</code></td>
  1228. <td valign="top">ignored</td>
  1229. </tr>
  1230. <tr>
  1231. <td valign="top"><code>C.properties</code></td>
  1232. <td valign="top"><code>Q.property</code></td>
  1233. </tr>
  1234. <tr>
  1235. <td valign="top"><code>Classes/dir/dir2/A.properties</code></td>
  1236. <td valign="top"><code>Qlasses/dir/dir2/A.property</td>
  1237. </tr>
  1238. </table>
  1239. <h4><a name="regexp-mapper">regexp</a></h4>
  1240. <p>Both <code>to</code> and <code>from</code> define regular
  1241. expressions. If the source file name matches the <code>from</code>
  1242. pattern, the target file name will be constructed from the
  1243. <code>to</code> pattern, using <code>\0</code> to <code>\9</code> as
  1244. back-references for the full
  1245. match (<code>\0</code>) or the matches of the subexpressions in
  1246. parentheses.
  1247. Source
  1248. files not matching the <code>from</code> pattern will be ignored.</p>
  1249. <p>Note that you need to escape a dollar-sign (<code>$</code>) with
  1250. another dollar-sign in Ant.</p>
  1251. <p>The regexp mapper needs a supporting library and an implementation
  1252. of <code>org.apache.tools.ant.util.regexp.RegexpMatcher</code> that
  1253. hides the specifics of the library. Ant comes with implementations for
  1254. <a href="http://jakarta.apache.org/regexp/">jakarta-regexp</a> and <a
  1255. href="http://jakarta.apache.org/oro/">jakarta-ORO</a>. If you compile
  1256. from sources and plan to use one of them, make sure the libraries are
  1257. in your <code>CLASSPATH</code>.</a> For information about using <a
  1258. href="http://www.cacas.org/~wes/java/">gnu.regexp</a> or <a
  1259. href="http://www.crocodile.org/~sts/Rex/">gnu.rex</a> with Ant, see <a
  1260. href="http://marc.theaimsgroup.com/?l=ant-dev&m=97550753813481&w=2">this</a>
  1261. article.</p>
  1262. <p>Ant will choose the regular-expression library based on the
  1263. following algorithm:
  1264. <ul>
  1265. <li>If the system property
  1266. <code>ant.regexp.matcherimpl</code> has been set, it is taken as the
  1267. name of the class implementing
  1268. <code>org.apache.tools.ant.util.regexp.RegexpMatcher</code> that
  1269. should be used.</li>
  1270. <li>If it has not been set, first try jakarta-ORO; if that
  1271. cannot be found, try jakarta-regexp.</li>
  1272. </ul>
  1273. </p>
  1274. <b>Examples:</b>
  1275. <blockquote><pre>
  1276. &lt;mapper type=&quot;regexp&quot; from=&quot;^(.*)\.java$$&quot; to=&quot;\1.java.bak&quot;/&gt;
  1277. </pre></blockquote>
  1278. <table border="1" cellpadding="2" cellspacing="0">
  1279. <tr>
  1280. <td valign="top"><b>Source file name</b></td>
  1281. <td valign="top"><b>Target file name</b></td>
  1282. </tr>
  1283. <tr>
  1284. <td valign="top"><code>A.java</code></td>
  1285. <td valign="top"><code>A.java.bak</code></td>
  1286. </tr>
  1287. <tr>
  1288. <td valign="top"><code>foo/bar/B.java</code></td>
  1289. <td valign="top"><code>foo/bar/B.java.bak</code></td>
  1290. </tr>
  1291. <tr>
  1292. <td valign="top"><code>C.properties</code></td>
  1293. <td valign="top">ignored</td>
  1294. </tr>
  1295. <tr>
  1296. <td valign="top"><code>Classes/dir/dir2/A.properties</code></td>
  1297. <td valign="top">ignored</td>
  1298. </tr>
  1299. </table>
  1300. <blockquote><pre>
  1301. &lt;mapper type=&quot;regexp&quot; from=&quot;^(.*)/([^/]+)/([^/]*)$$&quot; to=&quot;\1/\2/\2-\3&quot;/&gt;
  1302. </pre></blockquote>
  1303. <table border="1" cellpadding="2" cellspacing="0">
  1304. <tr>
  1305. <td valign="top"><b>Source file name</b></td>
  1306. <td valign="top"><b>Target file name</b></td>
  1307. </tr>
  1308. <tr>
  1309. <td valign="top"><code>A.java</code></td>
  1310. <td valign="top">ignored</td>
  1311. </tr>
  1312. <tr>
  1313. <td valign="top"><code>foo/bar/B.java</code></td>
  1314. <td valign="top"><code>foo/bar/bar-B.java</code></td>
  1315. </tr>
  1316. <tr>
  1317. <td valign="top"><code>C.properties</code></td>
  1318. <td valign="top">ignored</td>
  1319. </tr>
  1320. <tr>
  1321. <td valign="top"><code>Classes/dir/dir2/A.properties</code></td>
  1322. <td valign="top"><code>Classes/dir/dir2/dir2-A.properties</code></td>
  1323. </tr>
  1324. </table>
  1325. <blockquote><pre>
  1326. &lt;mapper type=&quot;regexp&quot; from=&quot;^(.*)\.(.*)$$&quot; to=&quot;\2.\1&quot;/&gt;
  1327. </pre></blockquote>
  1328. <table border="1" cellpadding="2" cellspacing="0">
  1329. <tr>
  1330. <td valign="top"><b>Source file name</b></td>
  1331. <td valign="top"><b>Target file name</b></td>
  1332. </tr>
  1333. <tr>
  1334. <td valign="top"><code>A.java</code></td>
  1335. <td valign="top"><code>java.A</code></td>
  1336. </tr>
  1337. <tr>
  1338. <td valign="top"><code>foo/bar/B.java</code></td>
  1339. <td valign="top"><code>java.foo/bar/B</code></td>
  1340. </tr>
  1341. <tr>
  1342. <td valign="top"><code>C.properties</code></td>
  1343. <td valign="top"><code>properties.C</code></td>
  1344. </tr>
  1345. <tr>
  1346. <td valign="top"><code>Classes/dir/dir2/A.properties</code></td>
  1347. <td valign="top"><code>properties.Classes/dir/dir2/A</code></td>
  1348. </tr>
  1349. </table>
  1350. <hr>
  1351. <h2><a name="bitasks">Built-in Tasks</a></h2>
  1352. <ul>
  1353. <li><a href="#ant">Ant</a></li>
  1354. <li><a href="#antcall">AntCall</a></li>
  1355. <li><a href="#antstructure">AntStructure</a></li>
  1356. <li><a href="#apply">Apply</a></li>
  1357. <li><a href="#available">Available</a></li>
  1358. <li><a href="#chmod">Chmod</a></li>
  1359. <li><a href="#copy">Copy</a></li>
  1360. <li><a href="#copydir">Copydir</a></li>
  1361. <li><a href="#copyfile">Copyfile</a></li>
  1362. <li><a href="#cvs">Cvs</a></li>
  1363. <li><a href="#delete">Delete</a></li>
  1364. <li><a href="#deltree">Deltree</a></li>
  1365. <li><a href="#echo">Echo</a></li>
  1366. <li><a href="#exec">Exec</a></li>
  1367. <li><a href="#execon">ExecOn</a></li>
  1368. <li><a href="#fail">Fail</a></li>
  1369. <li><a href="#filter">Filter</a></li>
  1370. <li><a href="#fixcrlf">FixCRLF</a></li>
  1371. <li><a href="#genkey">GenKey</a></li>
  1372. <li><a href="#get">Get</a></li>
  1373. <li><a href="#gunzip">GUnzip</a></li>
  1374. <li><a href="#gzip">GZip</a></li>
  1375. <li><a href="#jar">Jar</a></li>
  1376. <li><a href="#java">Java</a></li>
  1377. <li><a href="#javac">Javac</a></li>
  1378. <li><a href="#javadoc">Javadoc/Javadoc2</a></li>
  1379. <li><a href="#mail">Mail</a></li>
  1380. <li><a href="#mkdir">Mkdir</a></li>
  1381. <li><a href="#move">Move</a></li>
  1382. <li><a href="#patch">Patch</a></li>
  1383. <li><a href="#property">Property</a></li>
  1384. <li><a href="#rename">Rename</a></li>
  1385. <li><a href="#replace">Replace</a></li>
  1386. <li><a href="#rmic">Rmic</a></li>
  1387. <li><a href="#signjar">SignJar</a></li>
  1388. <li><a href="sql.html">Sql</a></li>
  1389. <li><a href="#style">Style</a></li>
  1390. <li><a href="#tar">Tar</a></li>
  1391. <li><a href="#taskdef">Taskdef</a></li>
  1392. <li><a href="#touch">Touch</a></li>
  1393. <li><a href="#tstamp">Tstamp</a></li>
  1394. <li><a href="#unzip">Unjar</a></li>
  1395. <li><a href="#untar">Untar</a></li>
  1396. <li><a href="#unzip">Unwar</a></li>
  1397. <li><a href="#unzip">Unzip</a></li>
  1398. <li><a href="#uptodate">Uptodate</a></li>
  1399. <li><a href="#war">War</a></li>
  1400. <li><a href="#zip">Zip</a></li>
  1401. </ul>
  1402. <hr>
  1403. <h2><a name="ant">Ant</a></h2>
  1404. <h3>Description</h3>
  1405. <p>Runs Ant on a supplied buildfile. This can be used to build subprojects.</p>
  1406. <p>When the <i>antfile</i> attribute is omitted, the file &quot;build.xml&quot;
  1407. in the supplied directory (<i>dir</i> attribute) is used.</p>
  1408. <p>If no target attribute is supplied, the default target of the new project is
  1409. used.</p>
  1410. <p>The properties of the current project will be available in the new project.
  1411. These properties will override the properties that are set in the new project.
  1412. (See also the <a href="#property">properties task</a>). You can set properties
  1413. in the new project from the old project by using nested property tags. This
  1414. allows you to parameterize your subprojects.</p>
  1415. <h3>Parameters</h3>
  1416. <table border="1" cellpadding="2" cellspacing="0">
  1417. <tr>
  1418. <td valign="top"><b>Attribute</b></td>
  1419. <td valign="top"><b>Description</b></td>
  1420. <td align="center" valign="top"><b>Required</b></td>
  1421. </tr>
  1422. <tr>
  1423. <td valign="top">antfile</td>
  1424. <td valign="top">the buildfile to use. Defaults to &quot;build.xml&quot;.</td>
  1425. <td valign="top" align="center">No</td>
  1426. </tr>
  1427. <tr>
  1428. <td valign="top">dir</td>
  1429. <td valign="top">the directory to use as a basedir for the new Ant project.
  1430. Defaults to the current directory.</td>
  1431. <td valign="top" align="center">No</td>
  1432. </tr>
  1433. <tr>
  1434. <td valign="top">target</td>
  1435. <td valign="top">the target of the new Ant project that should be executed.</td>
  1436. <td valign="top" align="center">No</td>
  1437. </tr>
  1438. <tr>
  1439. <td valign="top">output</td>
  1440. <td valign="top">Filename to write the ant output to.
  1441. </td>
  1442. <td align="center" valign="top">No</td>
  1443. </tr>
  1444. </table>
  1445. <h3>Examples</h3>
  1446. <pre>
  1447. &lt;ant antfile=&quot;subproject/subbuild.xml&quot; dir=&quot;subproject&quot; target=&quot;compile&quot;/&gt;
  1448. &lt;ant dir=&quot;subproject&quot;/&gt;
  1449. &lt;ant antfile=&quot;subproject/property_based_subbuild.xml&quot;&gt;
  1450. &lt;property name=&quot;param1&quot; value=&quot;version 1.x&quot;/&gt;
  1451. &lt;property file=&quot;config/subproject/default.properties&quot;/&gt;
  1452. &lt;/ant&gt;
  1453. </pre>
  1454. <hr>
  1455. <h2><a name="antcall">AntCall</a></h2>
  1456. <h3>Description</h3>
  1457. <p>Call another target within the same build-file optionally specifying some
  1458. properties (param's in this context)</p>
  1459. <h3>Parameters</h3>
  1460. <table border="1" cellpadding="2" cellspacing="0">
  1461. <tr>
  1462. <td valign="top"><b>Attribute</b></td>
  1463. <td valign="top"><b>Description</b></td>
  1464. <td align="center" valign="top"><b>Required</b></td>
  1465. </tr>
  1466. <tr>
  1467. <td valign="top">target</td>
  1468. <td valign="top">The target to execute.</td>
  1469. <td valign="top" align="center">Yes</td>
  1470. </tr>
  1471. </table>
  1472. <h3>Parameters specified as nested elements</h3>
  1473. <h4>param</h4>
  1474. <p>Specifies the properties to set before running the specified target. See <a
  1475. href="#property">property</a> for usage guidelines.</p>
  1476. <h3>Examples</h3>
  1477. <pre>
  1478. &lt;target name=&quot;default&quot;&gt;
  1479. &lt;antcall target=&quot;doSomethingElse&quot;&gt;
  1480. &lt;param name=&quot;param1&quot; value=&quot;value&quot;/&gt;
  1481. &lt;/antcall&gt;
  1482. &lt;/target&gt;
  1483. &lt;target name=&quot;doSomethingElse&quot;&gt;
  1484. &lt;echo message=&quot;param1=${param1}&quot;/&gt;
  1485. &lt;/target&gt;
  1486. </pre>
  1487. <p>Will run the target 'doSomethingElse' and echo 'param1=value'.</p>
  1488. <hr>
  1489. <h2><a name="antstructure">AntStructure</a></h2>
  1490. <h3>Description</h3>
  1491. <p>Generates a DTD for Ant buildfiles which contains information
  1492. about all tasks currently known to Ant.</p>
  1493. <p>Note that the DTD generated by this task is incomplete, you can
  1494. always add XML entities using <a
  1495. href="#taskdef"><code>&lt;taskdef&gt;</code></a>. See <a
  1496. href="http://www.sdv.fr/pages/casa/html/ant-dtd.en.html">here</a> for
  1497. a way to get around this problem.</p>
  1498. <p>This task doesn't know about required attributes, all will be
  1499. listed as <code>#IMPLIED</code>.</p>
  1500. <h3>Parameters</h3>
  1501. <table border="1" cellpadding="2" cellspacing="0">
  1502. <tr>
  1503. <td valign="top"><b>Attribute</b></td>
  1504. <td valign="top"><b>Description</b></td>
  1505. <td align="center" valign="top"><b>Required</b></td>
  1506. </tr>
  1507. <tr>
  1508. <td valign="top">output</td>
  1509. <td valign="top">file to write the DTD to.</td>
  1510. <td valign="top" align="center">Yes</td>
  1511. </tr>
  1512. </table>
  1513. <h3>Examples</h3>
  1514. <blockquote><pre>
  1515. &lt;antstructure output=&quot;project.dtd&quot;/&gt;
  1516. </pre></blockquote>
  1517. <hr>
  1518. <h2><a name="apply">Apply</a></h2>
  1519. <h3>Description</h3>
  1520. <p>Executes a system command. When the <i>os</i> attribute is specified, then
  1521. the command is only executed when Ant is run on one of the specified operating
  1522. systems.</p>
  1523. <p>The files and/or directories of a number of <a
  1524. href="#fileset">FileSet</a>s are passed as arguments to the system
  1525. command. The timestamp of each source file is compared to the
  1526. timestamp of a target file which is defined by a nested <a
  1527. href="#mapper">mapper</a> element. At least one fileset and exactly
  1528. one mapper element are required.</p>
  1529. <h3>Parameters</h3>
  1530. <table border="1" cellpadding="2" cellspacing="0">
  1531. <tr>
  1532. <td valign="top"><b>Attribute</b></td>
  1533. <td valign="top"><b>Description</b></td>
  1534. <td align="center" valign="top"><b>Required</b></td>
  1535. </tr>
  1536. <tr>
  1537. <td valign="top">executable</td>
  1538. <td valign="top">the command to execute without any command line
  1539. arguments.</td>
  1540. <td align="center" valign="top">Yes</td>
  1541. </tr>
  1542. <tr>
  1543. <td valign="top">dest</td>
  1544. <td valign="top">the directory where the target files will be placed.</td>
  1545. <td align="center" valign="top">Yes</td>
  1546. </tr>
  1547. <tr>
  1548. <td valign="top">dir</td>
  1549. <td valign="top">the directory in which the command should be executed.</td>
  1550. <td align="center" valign="top">No</td>
  1551. </tr>
  1552. <tr>
  1553. <td valign="top">os</td>
  1554. <td valign="top">list of Operating Systems on which the command may be
  1555. executed.</td>
  1556. <td align="center" valign="top">No</td>
  1557. </tr>
  1558. <tr>
  1559. <td valign="top">output</td>
  1560. <td valign="top">the file to which the output of the command should be
  1561. redirected.</td>
  1562. <td align="center" valign="top">No</td>
  1563. </tr>
  1564. <tr>
  1565. <td valign="top">timeout</td>
  1566. <td valign="top">Stop the command if it doesn't finish within the
  1567. specified time (given in milliseconds).</td>
  1568. <td align="center" valign="top">No</td>
  1569. </tr>
  1570. <tr>
  1571. <td valign="top">failonerror</td>
  1572. <td valign="top">Stop the buildprocess if the command exits with a
  1573. returncode other than 0.</td>
  1574. <td align="center" valign="top">No</td>
  1575. </tr>
  1576. <tr>
  1577. <td valign="top">parallel</td>
  1578. <td valign="top">Run the command only once, appending all files as
  1579. arguments. If false, command will be executed once for every file.
  1580. Defaults to false. </td>
  1581. <td align="center" valign="top">No</td>
  1582. </tr>
  1583. <tr>
  1584. <td valign="top">type</td>
  1585. <td valign="top">One of <i>file</i>, <i>dir</i> or
  1586. <i>both</i>. If set to <i>file</i>, only the names of plain
  1587. files will be sent to the command. If set to <i>dir</i>, only
  1588. the names of directories are considered.</td>
  1589. <td align="center" valign="top">No, default is <i>file</i></td>
  1590. </tr>
  1591. </table>
  1592. <h3>Parameters specified as nested elements</h3>
  1593. <h4>fileset</h4>
  1594. <p>You can use any number of nested <code>&lt;fileset&gt;</code>
  1595. elements to define the files for this task and refer to
  1596. <code>&lt;fileset&gt;</code>s defined elsewhere.</p>
  1597. <h4>arg</h4>
  1598. <p>Command line arguments should be specified as nested
  1599. <code>&lt;arg&gt;</code> elements. See <a
  1600. href="index.html#arg">Command line arguments</a>.</p>
  1601. <h4>srcfile</h4>
  1602. <p>By default the file names of the source files will be added to the
  1603. end of the command line. If you need to place it somewhere different,
  1604. use a nested <code>&lt;srcfile&gt;</code> element between your
  1605. <code>&lt;arg&gt;</code> elements to mark the insertion point.</code>
  1606. <h4>targetfile</h4>
  1607. <p><code>&lt;targetfile&gt;</code> is similar to
  1608. <code>&lt;srcfile&gt;</code> and marks the position of the target
  1609. filename on the command line. If omitted, the target filenames will
  1610. not be added to the command line at all.</p>
  1611. <h4>env</h4>
  1612. <p>It is possible to specify environment variables to pass to the
  1613. system command via nested <code>&lt;env&gt;</code> elements. See the
  1614. description in the section about <a href="#env">exec</a></p>
  1615. <p>Please note that the environment of the current Ant process is
  1616. <b>not</b> passed to the system command if you specify variables using
  1617. <code>&lt;env&gt;</code>.</p>
  1618. <h3>Examples</h3>
  1619. <blockquote><pre>
  1620. &lt;apply executable=&quot;cc&quot; dest=&quot;src/C&quot; parallel=&quot;false&quot;&gt;
  1621. &lt;arg value=&quot;-c&quot;/&gt;
  1622. &lt;arg value=&quot;-o&quot;/&gt;
  1623. &lt;targetfile/&gt;
  1624. &lt;srcfile/&gt;
  1625. &lt;fileset dir=&quot;src/C&quot; includes=&quot;*.c&quot;/&gt;
  1626. &lt;mapper type=&quot;glob&quot; from=&quot;*.c&quot; to=&quot;*.o&quot;/&gt;
  1627. &lt;/apply&gt;
  1628. </pre></blockquote>
  1629. <p>invokes <code>cc -c -o TARGETFILE SOURCEFILE</code> for each
  1630. <code>.c</code> file that is newer than the corresponding
  1631. <code>.o</code>, replacing TARGETFILE with the absolute filename of
  1632. the <code>.o</code> and SOURCEFILE with the absolute name of the
  1633. <code>.c</code> file.</p>
  1634. <hr>
  1635. <h2><a name="available">Available</a></h2>
  1636. <h3>Description</h3>
  1637. <p>Sets a property if a resource is available at runtime. This resource can be a
  1638. file resource, a class in classpath or a JVM system resource.</p>
  1639. <p>If the resource is present, the property value is set to true by
  1640. default, otherwise the property is not set. You can set the value to
  1641. something specific by using the value attribute.</p>
  1642. <p>Normally, this task is used to set properties that are useful to avoid target
  1643. execution depending on system parameters.</p>
  1644. <h3>Parameters</h3>
  1645. <table border="1" cellpadding="2" cellspacing="0">
  1646. <tr>
  1647. <td valign="top"><b>Attribute</b></td>
  1648. <td valign="top"><b>Description</b></td>
  1649. <td align="center" valign="top"><b>Required</b></td>
  1650. </tr>
  1651. <tr>
  1652. <td valign="top">property</td>
  1653. <td valign="top">the name of the property to set.</td>
  1654. <td valign="top" align="center">Yes</td>
  1655. </tr>
  1656. <tr>
  1657. <td valign="top">value</td>
  1658. <td valign="top">the value to set the property to. Defaults to &quot;true&quot;.</td>
  1659. <td valign="top" align="center">No</td>
  1660. </tr>
  1661. <tr>
  1662. <td valign="top">classname</td>
  1663. <td valign="top">the class to look for in classpath.</td>
  1664. <td valign="middle" align="center" rowspan="3">Yes</td>
  1665. </tr>
  1666. <tr>
  1667. <td valign="top">resource</td>
  1668. <td valign="top">the resource to look for in the JVM</td>
  1669. </tr>
  1670. <tr>
  1671. <td valign="top">file</td>
  1672. <td valign="top">the file to look for.</td>
  1673. </tr>
  1674. <tr>
  1675. <td valign="top">classpath</td> <td valign="top">the classpath to
  1676. use when looking up <code>classname</code>.</td> <td
  1677. align="center" valign="top">No</td>
  1678. </tr>
  1679. <tr>
  1680. <td valign="top">classpathref</td>
  1681. <td valign="top">the classpath to use, given as <a href="#references">reference</a> to a path defined elsewhere.</td>
  1682. <td align="center" valign="top">No</td>
  1683. </tr>
  1684. </table>
  1685. <h3>Parameters specified as nested elements</h3>
  1686. <h4>classpath</h4>
  1687. <p><code>Available</code>'s <i>classpath</i> attribute is a <a
  1688. href="#path">path-like structure</a> and can also be set via a nested
  1689. <i>classpath</i> element.</p>
  1690. <h3>Examples</h3>
  1691. <pre> &lt;available classname=&quot;org.whatever.Myclass&quot; property=&quot;Myclass.present&quot;/&gt;</pre>
  1692. <p>sets the property <code><i>Myclass.present</i></code> to the value &quot;true&quot;
  1693. if the class <i>org.whatever.Myclass</i> is found in Ant's classpath.</p>
  1694. <pre>
  1695. &lt;property name=&quot;jaxp.jar&quot; value=&quot;./lib/jaxp11/jaxp.jar&quot;/&gt;
  1696. &lt;available file=&quot;${jaxp.jar}&quot; property=&quot;jaxp.jar.present&quot;/&gt;
  1697. </pre>
  1698. <p>sets the property <code><i>jaxp.jar.present</i></code> to the value &quot;true&quot;
  1699. if the file <i>./lib/jaxp11/jaxp.jar</i> is found.</p>
  1700. <pre>
  1701. ...in project ...
  1702. &lt;property name=&quot;jaxp.jar&quot; value=&quot;./lib/jaxp11/jaxp.jar&quot;/&gt;
  1703. &lt;path id=&quot;jaxp&quot; location=&quot;${jaxp.jar}&quot;/&gt;
  1704. ...in target ...
  1705. &lt;available classname=&quot;javax.xml.transform.Transformer&quot; classpathref="jaxp" property=&quot;jaxp11.present&quot;/&gt;
  1706. </pre>
  1707. <p>sets the property <code><i>jaxp11.present</i></code> to the value &quot;true&quot;
  1708. if the class <i>javax.xml.transform.Transformer</i> is found in the classpath referenced by <code>jaxp</code> (in this case, it is <code>./lib/jaxp11/jaxp.jar</code>).
  1709. </p>
  1710. <hr>
  1711. <h2><a name="chmod">Chmod</a></h2>
  1712. <h3>Description</h3>
  1713. <p>Changes the permissions of a file or all files inside specified directories. Right now it has effect only under Unix.
  1714. The permissions are also UNIX style, like the argument for the chmod command.</p>
  1715. <p>See the section on <a href="#directorybasedtasks">directory based
  1716. tasks</a>, on how the inclusion/exclusion of files works, and how to
  1717. write patterns.</p>
  1718. <p>This task holds an implicit <a href="#fileset">FileSet</a> and
  1719. supports all of FileSet's attributes and nested elements
  1720. directly. More FileSets can be specified using nested
  1721. <code>&lt;fileset&gt;</code> elements.</p>
  1722. <h3>Parameters</h3>
  1723. <table border="1" cellpadding="2" cellspacing="0">
  1724. <tr>
  1725. <td valign="top"><b>Attribute</b></td>
  1726. <td valign="top"><b>Description</b></td>
  1727. <td align="center" valign="top"><b>Required</b></td>
  1728. </tr>
  1729. <tr>
  1730. <td valign="top">file</td>
  1731. <td valign="top">the file or single directory of which the permissions
  1732. must be changed.</td>
  1733. <td valign="top" valign="middle" rowspan="2">exactly one of the two or nested <code>&lt;fileset&gt;</code> elements.</td>
  1734. </tr>
  1735. <tr>
  1736. <td valign="top">dir</td>
  1737. <td valign="top">the directory which holds the files whose permissions
  1738. must be changed.</td>
  1739. </tr>
  1740. <tr>
  1741. <td valign="top">perm</td>
  1742. <td valign="top">the new permissions.</td>
  1743. <td valign="top" align="center">Yes</td>
  1744. </tr>
  1745. <tr>
  1746. <td valign="top">includes</td>
  1747. <td valign="top">comma separated list of patterns of files that must be
  1748. included. All files are included when omitted.</td>
  1749. <td valign="top" align="center">No</td>
  1750. </tr>
  1751. <tr>
  1752. <td valign="top">includesfile</td>
  1753. <td valign="top">the name of a file. Each line of this file is
  1754. taken to be an include pattern</td>
  1755. <td valign="top" align="center">No</td>
  1756. </tr>
  1757. <tr>
  1758. <td valign="top">excludes</td>
  1759. <td valign="top">comma separated list of patterns of files that must be
  1760. excluded. No files (except default excludes) are excluded when omitted.</td>
  1761. <td valign="top" align="center">No</td>
  1762. </tr>
  1763. <tr>
  1764. <td valign="top">excludesfile</td>
  1765. <td valign="top">the name of a file. Each line of this file is
  1766. taken to be an exclude pattern</td>
  1767. <td valign="top" align="center">No</td>
  1768. </tr>
  1769. <tr>
  1770. <td valign="top">defaultexcludes</td>
  1771. <td valign="top">indicates whether default excludes should be used or not
  1772. (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when omitted.</td>
  1773. <td valign="top" align="center">No</td>
  1774. </tr>
  1775. <tr>
  1776. <td valign="top">parallel</td>
  1777. <td valign="top">process all specified files using a single
  1778. <code>chmod</code> command. Defaults to true.</td>
  1779. <td valign="top" align="center">No</td>
  1780. </tr>
  1781. <tr>
  1782. <td valign="top">type</td>
  1783. <td valign="top">One of <i>file</i>, <i>dir</i> or
  1784. <i>both</i>. If set to <i>file</i>, only the permissions of
  1785. plain files are going to be changed. If set to <i>dir</i>, only
  1786. the directories are considered.</td>
  1787. <td align="center" valign="top">No, default is <i>file</i></td>
  1788. </tr>
  1789. </table>
  1790. <h3>Examples</h3>
  1791. <blockquote>
  1792. <p><code>&lt;chmod file=&quot;${dist}/start.sh&quot; perm=&quot;ugo+rx&quot;/&gt;</code></p>
  1793. </blockquote>
  1794. <p>makes the &quot;start.sh&quot; file readable and executable for anyone on a
  1795. UNIX system.</p>
  1796. <blockquote>
  1797. <pre>
  1798. &lt;chmod dir=&quot;${dist}/bin&quot; perm=&quot;ugo+rx&quot; includes=&quot;**/*.sh&quot;/&gt;
  1799. </pre>
  1800. </blockquote>
  1801. <p>makes all &quot;.sh&quot; files below <code>${dist}/bin</code>
  1802. readable and executable for anyone on a UNIX system.</p>
  1803. <blockquote>
  1804. <pre>
  1805. &lt;chmod perm=&quot;g+w&quot;&gt;
  1806. &lt;fileset dir=&quot;shared/sources1&quot;&gt;
  1807. &lt;exclude name=&quot;**/trial/**&quot;/&gt;
  1808. &lt;/fileset&gt;
  1809. &lt;fileset refid=&quot;other.shared.sources&quot;/&gt;
  1810. &lt;/chmod&gt;
  1811. </pre>
  1812. </blockquote>
  1813. <p>makes all files below <code>shared/sources1</code> (except those
  1814. below any directory named trial) writable for members of the same
  1815. group on a UNIX system. In addition all files belonging to a FileSet
  1816. with <code>id</code> <code>other.shared.sources</code> get the same
  1817. permissions.</p>
  1818. <hr>
  1819. <h2><a name="copy">Copy</a></h2>
  1820. <h3>Description</h3>
  1821. <p>Copies a file or Fileset to a new file or directory. Files are
  1822. only copied if the source file is newer than the destination file,
  1823. or when the destination file does not exist. However, you can explicitly
  1824. overwrite files with the <var>overwrite</var> attribute.</p>
  1825. <p><a href="#fileset">FileSet</a>s are used to select files to copy.
  1826. To use a fileset, the <var>todir</var> attribute must be set.</p>
  1827. <h3>Parameters</h3>
  1828. <table border="1" cellpadding="2" cellspacing="0">
  1829. <tr>
  1830. <td valign="top"><b>Attribute</b></td>
  1831. <td valign="top"><b>Description</b></td>
  1832. <td align="center" valign="top"><b>Required</b></td>
  1833. </tr>
  1834. <tr>
  1835. <td valign="top">file</td>
  1836. <td valign="top">The file to copy.</td>
  1837. <td valign="top" align="center">One of either <var>file</var> or
  1838. at least one nested fileset element.</td>
  1839. </tr>
  1840. <tr>
  1841. <td valign="top">preservelastmodified</td>
  1842. <td valign="top">Give the copied files the same last modified
  1843. time as the original files. Defaults to &quot;no&quot;.</td>
  1844. <td valign="top" align="center">No</td>
  1845. </tr>
  1846. <tr>
  1847. <td valign="top">tofile</td>
  1848. <td valign="top">The file to copy to.</td>
  1849. <td valign="top" align="center" rowspan="2">With the <var>file</var> attribute,
  1850. either <var>tofile</var> or <var>todir</var> can be used. With nested filesets,
  1851. only <var>todir</var> is allowed.</td>
  1852. </tr>
  1853. <tr>
  1854. <td valign="top">todir</td>
  1855. <td valign="top">The directory to copy to.</td>
  1856. </tr>
  1857. <tr>
  1858. <td valign="top">overwrite</td>
  1859. <td valign="top">Overwrite existing files even if the destination
  1860. files are newer. Defaults to &quot;no&quot;.</td>
  1861. <td valign="top" align="center">No</td>
  1862. </tr>
  1863. <tr>
  1864. <td valign="top">filtering</td>
  1865. <td valign="top">Indicates whether token filtering should take place during
  1866. the copy. Defaults to &quot;no&quot;.</td>
  1867. <td valign="top" align="center">No</td>
  1868. </tr>
  1869. <tr>
  1870. <td valign="top">flatten</td>
  1871. <td valign="top">Ignore directory structure of source directory,
  1872. copy all files into a single directory, specified by the <var>todir</var>
  1873. attribute. Defaults to &quot;no&quot;. Note that you can achieve the
  1874. same effect by using a <a href="#flatten-mapper">flatten mapper</a></td>
  1875. <td valign="top" align="center">No</td>
  1876. </tr>
  1877. <tr>
  1878. <td valign="top">includeEmptyDirs</td>
  1879. <td valign="top">Copy empty directories included with the nested FileSet(s).
  1880. Defaults to &quot;yes&quot;.</td>
  1881. <td valign="top" align="center">No</td>
  1882. </tr>
  1883. </table>
  1884. <h3>Parameters specified as nested elements</h3>
  1885. <h4>mapper</h4>
  1886. <p>You can define file name transformations by using a nested <a
  1887. href="#mapper">mapper</a> element. The default mapper used by
  1888. <code>&lt;copy&gt;</code> is the <a
  1889. href="#identity-mapper">identity</a>.</p>
  1890. <h3>Examples</h3>
  1891. <p><b>Copy a single file</b></p>
  1892. <pre>
  1893. &lt;copy file=&quot;myfile.txt&quot; tofile=&quot;mycopy.txt&quot;/&gt;
  1894. </pre>
  1895. <p><b>Copy a file to a directory</b></p>
  1896. <pre>
  1897. &lt;copy file=&quot;myfile.txt&quot; todir=&quot;../some/dir/tree&quot;/&gt;
  1898. </pre>
  1899. <p><b>Copy a directory to another directory</b></p>
  1900. <pre>
  1901. &lt;copy todir=&quot;../new/dir&quot;&gt;
  1902. &lt;fileset dir=&quot;src_dir&quot;/&gt;
  1903. &lt;/copy&gt;
  1904. </pre>
  1905. <p><b>Copy a set of files to a directory</b></p>
  1906. <pre>
  1907. &lt;copy todir=&quot;../dest/dir&quot; &gt;
  1908. &lt;fileset dir=&quot;src_dir&quot &gt;
  1909. &lt;exclude name=&quot;**/*.java&quot;/&gt;
  1910. &lt;/fileset&gt;
  1911. &lt;/copy&gt;
  1912. &lt;copy todir=&quot;../dest/dir&quot; &gt;
  1913. &lt;fileset dir=&quot;src_dir&quot excludes=&quot;**/*.java&quot;/&gt;
  1914. &lt;/copy&gt;
  1915. </pre>
  1916. <p><b>Copy a set of files to a directory appending
  1917. &quot;<code>.bak</code>&quot; to the file name on the fly</b></p>
  1918. <pre>
  1919. &lt;copy todir=&quot;../backup/dir&quot; &gt;
  1920. &lt;fileset dir=&quot;src_dir&quot /&gt;
  1921. &lt;mapper type=&quot;glob&quot; from=&quot;*&quot; to=&quot;*.bak&quot;/&gt;
  1922. &lt;/copy&gt;
  1923. </pre>
  1924. <hr>
  1925. <h2><a name="copydir">Copydir</a></h2>
  1926. <h3><i>Deprecated</i></h3>
  1927. <p><i>This task has been deprecated. Use the Copy task instead.</i></p>
  1928. <h3>Description</h3>
  1929. <p>Copies a directory tree from the source to the destination.</p>
  1930. <p>It is possible to refine the set of files that are being copied. This can be
  1931. done with the <i>includes</i>, <i>includesfile</i>, <i>excludes</i>, <i>excludesfile</i> and <i>defaultexcludes</i>
  1932. attributes. With the <i>includes</i> or <i>includesfile</i> attribute you specify the files you want to
  1933. have included by using patterns. The <i>exclude</i> or <i>excludesfile</i> attribute is used to specify
  1934. the files you want to have excluded. This is also done with patterns. And
  1935. finally with the <i>defaultexcludes</i> attribute, you can specify whether you
  1936. want to use default exclusions or not. See the section on <a
  1937. href="#directorybasedtasks">directory based tasks</a>, on how the
  1938. inclusion/exclusion of files works, and how to write patterns.</p>
  1939. <p>This task forms an implicit <a href="#fileset">FileSet</a> and
  1940. supports all attributes of <code>&lt;fileset&gt;</code>
  1941. (<code>dir</code> becomes <code>src</code>) as well as the nested
  1942. <code>&lt;include&gt;</code>, <code>&lt;exclude&gt;</code> and
  1943. <code>&lt;patternset&gt;</code> elements.</p>
  1944. <h3>Parameters</h3>
  1945. <table border="1" cellpadding="2" cellspacing="0">
  1946. <tr>
  1947. <td valign="top"><b>Attribute</b></td>
  1948. <td valign="top"><b>Description</b></td>
  1949. <td align="center" valign="top"><b>Required</b></td>
  1950. </tr>
  1951. <tr>
  1952. <td valign="top">src</td>
  1953. <td valign="top">the directory to copy.</td>
  1954. <td valign="top" align="center">Yes</td>
  1955. </tr>
  1956. <tr>
  1957. <td valign="top">dest</td>
  1958. <td valign="top">the directory to copy to.</td>
  1959. <td valign="top" align="center">Yes</td>
  1960. </tr>
  1961. <tr>
  1962. <td valign="top">includes</td>
  1963. <td valign="top">comma separated list of patterns of files that must be
  1964. included. All files are included when omitted.</td>
  1965. <td valign="top" align="center">No</td>
  1966. </tr>
  1967. <tr>
  1968. <td valign="top">includesfile</td>
  1969. <td valign="top">the name of a file. Each line of this file is
  1970. taken to be an include pattern</td>
  1971. <td valign="top" align="center">No</td>
  1972. </tr>
  1973. <tr>
  1974. <td valign="top">excludes</td>
  1975. <td valign="top">comma separated list of patterns of files that must be
  1976. excluded. No files (except default excludes) are excluded when omitted.</td>
  1977. <td valign="top" align="center">No</td>
  1978. </tr>
  1979. <tr>
  1980. <td valign="top">excludesfile</td>
  1981. <td valign="top">the name of a file. Each line of this file is
  1982. taken to be an exclude pattern</td>
  1983. <td valign="top" align="center">No</td>
  1984. </tr>
  1985. <tr>
  1986. <td valign="top">defaultexcludes</td>
  1987. <td valign="top">indicates whether default excludes should be used or not
  1988. (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when omitted.</td>
  1989. <td valign="top" align="center">No</td>
  1990. </tr>
  1991. <tr>
  1992. <td valign="top">filtering</td>
  1993. <td valign="top">indicates whether token filtering should take place during
  1994. the copy</td>
  1995. <td valign="top" align="center">No</td>
  1996. </tr>
  1997. <tr>
  1998. <td valign="top">flatten</td>
  1999. <td valign="top">ignore directory structure of source directory,
  2000. copy all files into a single directory, specified by the <code>dest</code>
  2001. attribute (default is <code>false</code>).</td>
  2002. <td valign="top" align="center">No</td>
  2003. </tr>
  2004. <tr>
  2005. <td valign="top">forceoverwrite</td>
  2006. <td valign="top">overwrite existing files even if the destination
  2007. files are newer (default is false).</td>
  2008. <td valign="top" align="center">No</td>
  2009. </tr>
  2010. </table>
  2011. <h3>Examples</h3>
  2012. <pre> &lt;copydir src=&quot;${src}/resources&quot;
  2013. dest=&quot;${dist}&quot;
  2014. /&gt;</pre>
  2015. <p>copies the directory <code>${src}/resources</code> to <code>${dist}</code>.</p>
  2016. <pre> &lt;copydir src=&quot;${src}/resources&quot;
  2017. dest=&quot;${dist}&quot;
  2018. includes=&quot;**/*.java&quot;
  2019. excludes=&quot;**/Test.java&quot;
  2020. /&gt;</pre>
  2021. <p>copies the directory <code>${src}/resources</code> to <code>${dist}</code>
  2022. recursively. All java files are copied, except for files with the name <code>Test.java</code>.</p>
  2023. <pre> &lt;copydir src=&quot;${src}/resources&quot;
  2024. dest=&quot;${dist}&quot;
  2025. includes=&quot;**/*.java&quot;
  2026. excludes=&quot;mypackage/test/**&quot;/&gt;</pre>
  2027. <p>copies the directory <code>${src}/resources</code> to <code>${dist}</code>
  2028. recursively. All java files are copied, except for the files under the <code>mypackage/test</code>
  2029. directory.</p>
  2030. <hr>
  2031. <h2><a name="copyfile">Copyfile</a></h2>
  2032. <h3><i>Deprecated</i></h3>
  2033. <p><i>This task has been deprecated. Use the Copy task instead.</i></p>
  2034. <h3>Description</h3>
  2035. <p>Copies a file from the source to the destination. The file is only copied if
  2036. the source file is newer than the destination file, or when the destination file
  2037. does not exist.</p>
  2038. <h3>Parameters</h3>
  2039. <table border="1" cellpadding="2" cellspacing="0">
  2040. <tr>
  2041. <td valign="top"><b>Attribute</b></td>
  2042. <td valign="top"><b>Description</b></td>
  2043. <td align="center" valign="top"><b>Required</b></td>
  2044. </tr>
  2045. <tr>
  2046. <td valign="top">src</td>
  2047. <td valign="top">the filename of the file to copy.</td>
  2048. <td valign="top" align="center">Yes</td>
  2049. </tr>
  2050. <tr>
  2051. <td valign="top">dest</td>
  2052. <td valign="top">the filename of the file where to copy to.</td>
  2053. <td valign="top" align="center">Yes</td>
  2054. </tr>
  2055. <tr>
  2056. <td valign="top">filtering</td>
  2057. <td valign="top">indicates whether token filtering should take place during
  2058. the copy</td>
  2059. <td valign="top" align="center">No</td>
  2060. </tr>
  2061. <tr>
  2062. <td valign="top">forceoverwrite</td>
  2063. <td valign="top">overwrite existing files even if the destination
  2064. files are newer (default is false).</td>
  2065. <td valign="top" align="center">No</td>
  2066. </tr>
  2067. </table>
  2068. <h3>Examples</h3>
  2069. <blockquote>
  2070. <p><code>&lt;copyfile src=&quot;test.java&quot; dest=&quot;subdir/test.java&quot;
  2071. /&gt;</code></p>
  2072. <p><code>&lt;copyfile src=&quot;${src}/index.html&quot; dest=&quot;${dist}/help/index.html&quot;
  2073. /&gt;</code></p>
  2074. </blockquote>
  2075. <hr>
  2076. <h2><a name="cvs">Cvs</a></h2>
  2077. <h3>Description</h3>
  2078. <p>Handles packages/modules retrieved from a
  2079. <a href="http://www.cvshome.org/">CVS</a> repository.</p>
  2080. <p>When doing automated builds, the <a href="#get">get task</a> should be
  2081. preferred over the <i>checkout</i> command, because of speed.</p>
  2082. <h3>Parameters</h3>
  2083. <table border="1" cellpadding="2" cellspacing="0">
  2084. <tr>
  2085. <td valign="top"><b>Attribute</b></td>
  2086. <td valign="top"><b>Description</b></td>
  2087. <td align="center" valign="top"><b>Required</b></td>
  2088. </tr>
  2089. <tr>
  2090. <td valign="top">command</td>
  2091. <td valign="top">the CVS command to execute.</td>
  2092. <td align="center" valign="top">No, default &quot;checkout&quot;</td>
  2093. </tr>
  2094. <tr>
  2095. <td valign="top">cvsRoot</td>
  2096. <td valign="top">the CVSROOT variable.</td>
  2097. <td align="center" valign="top">No</td>
  2098. </tr>
  2099. <tr>
  2100. <td valign="top">dest</td>
  2101. <td valign="top">the directory where the checked out files should be placed.</td>
  2102. <td align="center" valign="top">No, default is project's basedir.</td>
  2103. </tr>
  2104. <tr>
  2105. <td valign="top">package</td>
  2106. <td valign="top">the package/module to check out.</td>
  2107. <td align="center" valign="top">No</td>
  2108. </tr>
  2109. <tr>
  2110. <td valign="top">tag</td>
  2111. <td valign="top">the tag of the package/module to check out.</td>
  2112. <td align="center" valign="top">No</td>
  2113. </tr>
  2114. <tr>
  2115. <td valign="top">date</td>
  2116. <td valign="top">Use the most recent revision no later than the given date</td>
  2117. <td align="center" valign="top">No</td>
  2118. </tr>
  2119. <tr>
  2120. <td valign="top">quiet</td>
  2121. <td valign="top">suppress informational messages.</td>
  2122. <td align="center" valign="top">No, default &quot;false&quot;</td>
  2123. </tr>
  2124. <tr>
  2125. <td valign="top">noexec</td>
  2126. <td valign="top">report only, don't change any files.</td>
  2127. <td align="center" valign="top">No, default &quot;false&quot;</td>
  2128. </tr>
  2129. <tr>
  2130. <td valign="top">output</td>
  2131. <td valign="top">the file to direct standard output from the command.</td>
  2132. <td align="center" valign="top">No, default output to ANT Log as MSG_INFO.</td>
  2133. </tr>
  2134. <tr>
  2135. <td valign="top">error</td>
  2136. <td valign="top">the file to direct standard error from the command.</td>
  2137. <td align="center" valign="top">No, default error to ANT Log as MSG_WARN.</td>
  2138. </tr>
  2139. </table>
  2140. <h3>Examples</h3>
  2141. <pre> &lt;cvs cvsRoot=&quot;:pserver:anoncvs@jakarta.apache.org:/home/cvspublic&quot;
  2142. package=&quot;jakarta-tools&quot;
  2143. dest=&quot;${ws.dir}&quot;
  2144. /&gt;</pre>
  2145. <p>checks out the package/module &quot;jakarta-tools&quot; from the CVS
  2146. repository pointed to by the cvsRoot attribute, and stores the files in &quot;${ws.dir}&quot;.</p>
  2147. <pre> &lt;cvs dest=&quot;${ws.dir}&quot; command=&quot;update&quot;/&gt;</pre>
  2148. <p>updates the package/module that has previously been checked out into
  2149. &quot;${ws.dir}&quot;.</p>
  2150. <pre> &lt;cvs command=&quot;-q diff -u -N&quot; output="patch.txt"/&gt;</pre>
  2151. <p>silently (-q) creates a file called patch.txt which contains a unified (-u) diff which includes new files added via &quot;cvs add&quot; (-N) and can be used as input to patch.</p>
  2152. <pre> &lt;cvs command=&quot;update -A -d&quot;/&gt;</pre>
  2153. <p>Updates from the head of repository ignoring sticky bits (-A) and creating any new directories as necessary (-d).</p>
  2154. <p>Note: the text of the command is passed to cvs &quot;as-is&quot; so any cvs options should appear before the command, and any command options should appear after the command as in the diff example above. See <a href="http://www.cvshome.org/docs/manual/index.html">the cvs manual</a> for details, specifically the <a href="http://www.cvshome.org/docs/manual/cvs_16.html">Guide to CVS commands</a></p>
  2155. <hr>
  2156. <h2><a name="delete">Delete</a></h2>
  2157. <h3>Description</h3>
  2158. <p>Deletes either a single file, all files in a specified directory and its
  2159. sub-directories, or a set of files specified by one or more <a href="#fileset">FileSet</a>s.
  2160. When specifying a set of files, empty directories are <i>not</i> removed by default.
  2161. To remove empty directories, use the <em>includeEmptyDirs</em> atribute.</p>
  2162. <h3>Parameters</h3>
  2163. <table border="1" cellpadding="2" cellspacing="0">
  2164. <tr>
  2165. <td valign="top"><b>Attribute</b></td>
  2166. <td valign="top"><b>Description</b></td>
  2167. <td align="center" valign="top"><b>Required</b></td>
  2168. </tr>
  2169. <tr>
  2170. <td valign="top">file</td>
  2171. <td valign="top">The file to delete.</td>
  2172. <td align="center" valign="middle" rowspan="2">at least one of the two</td>
  2173. </tr>
  2174. <tr>
  2175. <td valign="top">dir</td>
  2176. <td valign="top">The directory to delete files from.</td>
  2177. </tr>
  2178. <tr>
  2179. <td valign="top">verbose</td>
  2180. <td valign="top">Show name of each deleted file (&quot;true&quot;/&quot;false&quot;).
  2181. Default is &quot;false&quot; when omitted.</td>
  2182. <td align="center" valign="top">No</td>
  2183. </tr>
  2184. <tr>
  2185. <td valign="top">quiet</td>
  2186. <td valign="top">If the file does not exist, do not display a diagnostic
  2187. message or modify the exit status to reflect an error.
  2188. This means that if a file or directory cannot be deleted,
  2189. then no error is reported. This setting emulates the
  2190. -f option to the Unix &quot;rm&quot; command.
  2191. (&quot;true&quot;/&quot;false&quot;).
  2192. Default is &quot;false&quot; meaning things are &quot;noisy&quot;.</td>
  2193. <td align="center" valign="top">No</td>
  2194. </tr>
  2195. <tr>
  2196. <td valign="top">includeEmptyDirs</td>
  2197. <td valign="top">Set to &quot;true&quot; to delete empty directores when
  2198. using filesets. Default is &quot;false&quot;.</td>
  2199. <td align="center" valign="top">No</td>
  2200. </tr>
  2201. <tr>
  2202. <td valign="top">includes</td>
  2203. <td valign="top"><i>Deprecated.</i> Comma separated list of patterns of files that must be
  2204. deleted. All files are in the current directory
  2205. and any sub-directories are deleted when omitted.</td>
  2206. <td valign="top" align="center">No</td>
  2207. </tr>
  2208. <tr>
  2209. <td valign="top">includesfile</td>
  2210. <td valign="top"><i>Deprecated.</i> The name of a file. Each line of this file is
  2211. taken to be an include pattern</td>
  2212. <td valign="top" align="center">No</td>
  2213. </tr>
  2214. <tr>
  2215. <td valign="top">excludes</td>
  2216. <td valign="top"><i>Deprecated.</i> Comma separated list of patterns of files that must be
  2217. excluded from the deletion list. No files (except default excludes) are excluded when omitted.</td>
  2218. <td valign="top" align="center">No</td>
  2219. </tr>
  2220. <tr>
  2221. <td valign="top">excludesfile</td>
  2222. <td valign="top"><i>Deprecated.</i> The name of a file. Each line of this file is
  2223. taken to be an exclude pattern</td>
  2224. <td valign="top" align="center">No</td>
  2225. </tr>
  2226. <tr>
  2227. <td valign="top">defaultexcludes</td>
  2228. <td valign="top"><i>Deprecated.</i> Indicates whether default excludes should be used or not
  2229. (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when omitted.</td>
  2230. <td valign="top" align="center">No</td>
  2231. </tr>
  2232. </table>
  2233. <h3>Examples</h3>
  2234. <pre> &lt;delete file=&quot;/lib/ant.jar&quot;/&gt;</pre>
  2235. <p>deletes the file <code>/lib/ant.jar</code>.</p>
  2236. <pre> &lt;delete dir=&quot;lib&quot;/&gt;</pre>
  2237. <p>deletes the <code>lib</code> directory, including all files
  2238. and subdirectories of <code>lib</code>.</p>
  2239. <pre> &lt;delete&gt;
  2240. &lt;fileset dir=&quot;.&quot; includes=&quot;**/*.bak&quot;/&gt;
  2241. &lt;/delete&gt;
  2242. </pre>
  2243. <p>deletes all files with the extension &quot;<code>.bak</code>&quot from the current directory
  2244. and any sub-directories.</p>
  2245. <pre> &lt;delete includeEmptyDirs=&quot;true&quot; &gt;
  2246. &lt;fileset dir=&quot;build&quot; /&gt;
  2247. &lt;/delete&gt;
  2248. </pre>
  2249. <p>deletes all files and subdirectories of <code>build</code>, but not
  2250. <code>build</code> itself.<p>
  2251. <hr>
  2252. <h2><a name="deltree">Deltree</a></h2>
  2253. <h3><i>Deprecated</i></h3>
  2254. <p><i>This task has been deprecated. Use the Delete task instead.</i></p>
  2255. <h3>Description</h3>
  2256. <p>Deletes a directory with all its files and subdirectories.</p>
  2257. <h3>Parameters</h3>
  2258. <table border="1" cellpadding="2" cellspacing="0">
  2259. <tr>
  2260. <td valign="top"><b>Attribute</b></td>
  2261. <td valign="top"><b>Description</b></td>
  2262. <td align="center" valign="top"><b>Required</b></td>
  2263. </tr>
  2264. <tr>
  2265. <td valign="top">dir</td>
  2266. <td valign="top">the directory to delete.</td>
  2267. <td valign="top" align="center">Yes</td>
  2268. </tr>
  2269. </table>
  2270. <h3>Examples</h3>
  2271. <pre> &lt;deltree dir=&quot;dist&quot;/&gt;</pre>
  2272. <p>deletes the directory <code>dist</code>, including its files and
  2273. subdirectories.</p>
  2274. <pre> &lt;deltree dir=&quot;${dist}&quot;/&gt;</pre>
  2275. <p>deletes the directory <code>${dist}</code>, including its files and
  2276. subdirectories.</p>
  2277. <hr>
  2278. <h2><a name="echo">Echo</a></h2>
  2279. <h3>Description</h3>
  2280. <p>Echoes a message to System.out or a file.</p>
  2281. <h3>Parameters</h3>
  2282. <table border="1" cellpadding="2" cellspacing="0">
  2283. <tr>
  2284. <td valign="top"><b>Attribute</b></td>
  2285. <td valign="top"><b>Description</b></td>
  2286. <td align="center" valign="top"><b>Required</b></td>
  2287. </tr>
  2288. <tr>
  2289. <td valign="top">message</td>
  2290. <td valign="top">the message to echo.</td>
  2291. <td valign="top" align="center">Yes, unless data is included in a
  2292. character section within this element.</td>
  2293. </tr>
  2294. <tr>
  2295. <td valign="top">file</td>
  2296. <td valign="top">the file to write the message to.</td>
  2297. <td valign="top" align="center">No</td>
  2298. </tr>
  2299. <tr>
  2300. <td valign="top">append</td>
  2301. <td valign="top">Append to an existing file?</td>
  2302. <td valign="top" align="center">No &#150; default is false.</td>
  2303. </tr>
  2304. </table>
  2305. <h3>Examples</h3>
  2306. <pre> &lt;echo message=&quot;Hello world&quot;/&gt;</pre>
  2307. <pre>
  2308. &lt;echo&gt;
  2309. This is a longer message stretching over
  2310. two lines.
  2311. &lt;/echo&gt;
  2312. </pre>
  2313. <hr>
  2314. <h2><a name="exec">Exec</a></h2>
  2315. <h3>Description</h3>
  2316. <p>Executes a system command. When the <i>os</i> attribute is specified, then
  2317. the command is only executed when Ant is run on one of the specified operating
  2318. systems.</p>
  2319. <h3>Parameters</h3>
  2320. <table border="1" cellpadding="2" cellspacing="0">
  2321. <tr>
  2322. <td valign="top"><b>Attribute</b></td>
  2323. <td valign="top"><b>Description</b></td>
  2324. <td align="center" valign="top"><b>Required</b></td>
  2325. </tr>
  2326. <tr>
  2327. <td valign="top">command</td>
  2328. <td valign="top">the command to execute with all command line
  2329. arguments. <b>deprecated, use executable and nested
  2330. <code>&lt;arg&gt;</code> elements instead</b>.</td>
  2331. <td align="center" rowspan="2">Exactly one of the two.</td>
  2332. </tr>
  2333. <tr>
  2334. <td valign="top">executable</td>
  2335. <td valign="top">the command to execute without any command line
  2336. arguments.</td>
  2337. </tr>
  2338. <tr>
  2339. <td valign="top">dir</td>
  2340. <td valign="top">the directory in which the command should be executed.</td>
  2341. <td align="center" valign="top">No</td>
  2342. </tr>
  2343. <tr>
  2344. <td valign="top">os</td>
  2345. <td valign="top">list of Operating Systems on which the command may be
  2346. executed.</td>
  2347. <td align="center" valign="top">No</td>
  2348. </tr>
  2349. <tr>
  2350. <td valign="top">output</td>
  2351. <td valign="top">the file to which the output of the command should be
  2352. redirected.</td>
  2353. <td align="center" valign="top">No</td>
  2354. </tr>
  2355. <tr>
  2356. <td valign="top">timeout</td>
  2357. <td valign="top">Stop the command if it doesn't finish within the
  2358. specified time (given in milliseconds).</td>
  2359. <td align="center" valign="top">No</td>
  2360. </tr>
  2361. <tr>
  2362. <td valign="top">failonerror</td>
  2363. <td valign="top">Stop the buildprocess if the command exits with a
  2364. returncode other than 0.</td>
  2365. <td align="center" valign="top">No</td>
  2366. </tr>
  2367. <tr>
  2368. <td valign="top">newenvironment</td>
  2369. <td valign="top">Do not propagate old environment when new environment
  2370. variables are specified.</td>
  2371. <td align="center" valign="top">No, default is <i>false</i></td>
  2372. </tr>
  2373. </table>
  2374. <h3>Examples</h3>
  2375. <blockquote>
  2376. <p>
  2377. <pre>
  2378. &lt;exec dir=&quot;${src}&quot; executable=&quot;cmd.exe&quot; os=&quot;Windows 2000&quot; output=&quot;dir.txt&quot;&gt;
  2379. &lt;arg line=&quot;/c dir&quot;/&gt;
  2380. &lt;/exec&gt;</pre></p>
  2381. </blockquote>
  2382. <h3>Parameters specified as nested elements</h3>
  2383. <h4>arg</h4>
  2384. <p>Command line arguments should be specified as nested
  2385. <code>&lt;arg&gt;</code> elements. See <a
  2386. href="index.html#arg">Command line arguments</a>.</p>
  2387. <h4><a name="env">env</a></h4>
  2388. <p>It is possible to specify environment variables to pass to the
  2389. system command via nested <code>&lt;env&gt;</code> elements.</p>
  2390. <p>Please note that the environment of the current Ant process is
  2391. <b>not</b> passed to the system command if you specify variables using
  2392. <code>&lt;env&gt;</code>.</p>
  2393. <table border="1" cellpadding="2" cellspacing="0">
  2394. <tr>
  2395. <td valign="top"><b>Attribute</b></td>
  2396. <td valign="top"><b>Description</b></td>
  2397. <td align="center" valign="top"><b>Required</b></td>
  2398. </tr>
  2399. <tr>
  2400. <td valign="top">key</td>
  2401. <td valign="top">The name of the environment variable.</td>
  2402. <td align="center" valign="top">Yes</td>
  2403. </tr>
  2404. <tr>
  2405. <td valign="top">value</td>
  2406. <td valign="top">The literal value for the environment variable.</td>
  2407. <td align="center" rowspan="3">Exactly one of these.</td>
  2408. </tr>
  2409. <tr>
  2410. <td valign="top">path</td>
  2411. <td valign="top">The value for a PATH like environment
  2412. variable. You can use ; or : as path separators and Ant will
  2413. convert it to the platform's local conventions.</td>
  2414. </tr>
  2415. <tr>
  2416. <td valign="top">file</td>
  2417. <td valign="top">The value for the environment variable. Will be
  2418. replaced by the absolute filename of the file by Ant.</td>
  2419. </tr>
  2420. </table>
  2421. <h5>Examples</h5>
  2422. <blockquote><pre>
  2423. &lt;exec executable=&quot;emacs&quot; &gt;
  2424. &lt;env key=&quot;DISPLAY&quot; value=&quot;:1.0&quot;/&gt;
  2425. &lt;/exec&gt;
  2426. </pre></blockquote>
  2427. <p>starts <code>emacs</code> on display 1 of the X Window System.</p>
  2428. <blockquote><pre>
  2429. &lt;exec ... &gt;
  2430. &lt;env key=&quot;PATH&quot; path=&quot;${java.library.path}:${basedir}/bin&quot;/&gt;
  2431. &lt;/exec&gt;
  2432. </pre></blockquote>
  2433. <p>adds <code>${basedir}/bin</code> to the <code>PATH</code> of the
  2434. system command.</p>
  2435. <p><b>Note:</b> Although it may work for you to specify arguments using
  2436. a simple arg-element and seperate them by spaces it may fail if you switch to
  2437. a newer version of the JDK. JDK &lt; 1.2 will pass these as separate arguments
  2438. to the program you are calling, JDK &gt;= 1.2 will pass them as a single
  2439. argument and cause most calls to fail.</p>
  2440. <p><b>Note2:</b> If you are using Ant on Windows and a new DOS-Window pops up
  2441. for every command which is excuted this may be a problem of the JDK you are using.
  2442. This problem may occur with all JDK's &lt; 1.2.</p>
  2443. <hr>
  2444. <h2><a name="execon">ExecOn</a></h2>
  2445. <h3>Description</h3>
  2446. <p>Executes a system command. When the <i>os</i> attribute is specified, then
  2447. the command is only executed when Ant is run on one of the specified operating
  2448. systems.</p>
  2449. <p>The files and/or directories of a number of <a
  2450. href="#fileset">FileSet</a>s are passed as arguments to the system
  2451. command. At least one nested <code>&lt;fileset&gt;</code> is required.</p>
  2452. <h3>Parameters</h3>
  2453. <table border="1" cellpadding="2" cellspacing="0">
  2454. <tr>
  2455. <td valign="top"><b>Attribute</b></td>
  2456. <td valign="top"><b>Description</b></td>
  2457. <td align="center" valign="top"><b>Required</b></td>
  2458. </tr>
  2459. <tr>
  2460. <td valign="top">executable</td>
  2461. <td valign="top">the command to execute without any command line
  2462. arguments.</td>
  2463. <td align="center" valign="top">Yes</td>
  2464. </tr>
  2465. <tr>
  2466. <td valign="top">dir</td>
  2467. <td valign="top">the directory in which the command should be executed.</td>
  2468. <td align="center" valign="top">No</td>
  2469. </tr>
  2470. <tr>
  2471. <td valign="top">os</td>
  2472. <td valign="top">list of Operating Systems on which the command may be
  2473. executed.</td>
  2474. <td align="center" valign="top">No</td>
  2475. </tr>
  2476. <tr>
  2477. <td valign="top">output</td>
  2478. <td valign="top">the file to which the output of the command should be
  2479. redirected.</td>
  2480. <td align="center" valign="top">No</td>
  2481. </tr>
  2482. <tr>
  2483. <td valign="top">timeout</td>
  2484. <td valign="top">Stop the command if it doesn't finish within the
  2485. specified time (given in milliseconds).</td>
  2486. <td align="center" valign="top">No</td>
  2487. </tr>
  2488. <tr>
  2489. <td valign="top">failonerror</td>
  2490. <td valign="top">Stop the buildprocess if the command exits with a
  2491. returncode other than 0.</td>
  2492. <td align="center" valign="top">No</td>
  2493. </tr>
  2494. <tr>
  2495. <td valign="top">newenvironment</td>
  2496. <td valign="top">Do not propagate old environment when new environment
  2497. variables are specified.</td>
  2498. <td align="center" valign="top">No, default is <i>false</i></td>
  2499. </tr>
  2500. <tr>
  2501. <td valign="top">parallel</td>
  2502. <td valign="top">Run the command only once, appending all files as
  2503. arguments. If false, command will be executed once for every file.
  2504. Defaults to false. </td>
  2505. <td align="center" valign="top">No</td>
  2506. </tr>
  2507. <tr>
  2508. <td valign="top">type</td>
  2509. <td valign="top">One of <i>file</i>, <i>dir</i> or
  2510. <i>both</i>. If set to <i>file</i>, only the names of plain
  2511. files will be sent to the command. If set to <i>dir</i>, only
  2512. the names of directories are considered.</td>
  2513. <td align="center" valign="top">No, default is <i>file</i></td>
  2514. </tr>
  2515. </table>
  2516. <h3>Parameters specified as nested elements</h3>
  2517. <h4>fileset</h4>
  2518. <p>You can use any number of nested <code>&lt;fileset&gt;</code>
  2519. elements to define the files for this task and refer to
  2520. <code>&lt;fileset&gt;</code>s defined elsewhere.</p>
  2521. <h4>arg</h4>
  2522. <p>Command line arguments should be specified as nested
  2523. <code>&lt;arg&gt;</code> elements. See <a
  2524. href="index.html#arg">Command line arguments</a>.</p>
  2525. <h4>srcfile</h4>
  2526. <p>By default the file names of the source files will be added to the
  2527. end of the command line. If you need to place it somewhere different,
  2528. use a nested <code>&lt;srcfile&gt;</code> element between your
  2529. <code>&lt;arg&gt;</code> elements to mark the insertion point.</code>
  2530. <h4>env</h4>
  2531. <p>It is possible to specify environment variables to pass to the
  2532. system command via nested <code>&lt;env&gt;</code> elements. See the
  2533. description in the section about <a href="#env">exec</a></p>
  2534. <p>Please note that the environment of the current Ant process is
  2535. <b>not</b> passed to the system command if you specify variables using
  2536. <code>&lt;env&gt;</code>.</p>
  2537. <h3>Examples</h3>
  2538. <blockquote><pre>
  2539. &lt;execon executable=&quot;ls&quot; &gt;
  2540. &lt;arg value=&quot;-l&quot;/&gt;
  2541. &lt;fileset dir=&quot;/tmp&quot;&gt;
  2542. &lt;patternset&gt;
  2543. &lt;exclude name=&quot;**/*.txt&quot;/&gt;
  2544. &lt;/patternset&gt;
  2545. &lt;/fileset&gt;
  2546. &lt;fileset refid=&quot;other.files&quot;/&gt;
  2547. &lt;/execon&gt;
  2548. </pre></blockquote>
  2549. <p>invokes <code>ls -l</code>, adding the absolute filenames of all
  2550. files below <code>/tmp</code> not ending in <code>.txt</code> and all
  2551. files of the FileSet with <code>id</code> <code>other.files</code> to
  2552. the command line.</p>
  2553. <blockquote><pre>
  2554. &lt;execon executable=&quot;somecommand&quot; parallel=&quot;false&quot; &gt;
  2555. &lt;arg value=&quot;arg1&quot;/&gt;
  2556. &lt;srfile/&gt;
  2557. &lt;arg value=&quot;arg2&quot;/&gt;
  2558. &lt;fileset dir=&quot;/tmp&quot;/&gt;
  2559. &lt;/execon&gt;
  2560. </pre></blockquote>
  2561. <p>invokes <code>somecommand arg1 SOURCEFILENAME arg2</code> for each
  2562. file in <code>/tmp</code> replacing SOURCEFILENAME with the absolute
  2563. filename of each file in turn. If <code>parallel</code> had been set
  2564. to true, SOURCEFILENAME would be replaced with the absolute filenames
  2565. of all files separated by spaces.</p>
  2566. <hr>
  2567. <h2><a name="fail">Fail</a></h2>
  2568. <h3>Description</h3>
  2569. <p>Exits the current build (just throwing a BuildException), optionally printing additional information.</p>
  2570. <h3>Parameters</h3>
  2571. <table border="1" cellpadding="2" cellspacing="0">
  2572. <tr>
  2573. <td valign="top"><b>Attribute</b></td>
  2574. <td valign="top"><b>Description</b></td>
  2575. <td align="center" valign="top"><b>Required</b></td>
  2576. </tr>
  2577. <tr>
  2578. <td valign="top">message</td>
  2579. <td valign="top">A message giving further information on why the build exited</td>
  2580. <td align="center" valign="top">No</td>
  2581. </tr>
  2582. </table>
  2583. <h3>Examples</h3>
  2584. <pre> &lt;fail/&gt;</pre>
  2585. <p>will exit the current build with no further information given.
  2586. <pre>
  2587. BUILD FAILED
  2588. build.xml:4: No message
  2589. </pre>
  2590. <pre> &lt;fail message=&quot;Something wrong here.&quot;/&gt;</pre>
  2591. <p>will exit the current build and print something like the following to whereever
  2592. your output goes:
  2593. <pre>
  2594. BUILD FAILED
  2595. build.xml:4: Something wrong here.
  2596. </pre>
  2597. <hr>
  2598. <h2><a name="filter">Filter</a></h2>
  2599. <h3>Description</h3>
  2600. <p>Sets a token filter for this project or read multiple token filter from
  2601. an input file and sets these as filters.
  2602. Token filters are used by all tasks that perform file copying operations
  2603. through the Project commodity methods.</p>
  2604. <p>Note 1: the token string must not contain the separators chars (@).<br>
  2605. Note 2: Either token and value attributes must be provided, or only the
  2606. filterfile attribute.</p>
  2607. <h3>Parameters</h3>
  2608. <table border="1" cellpadding="2" cellspacing="0">
  2609. <tr>
  2610. <td valign="top"><b>Attribute</b></td>
  2611. <td valign="top"><b>Description</b></td>
  2612. <td align="center" valign="top"><b>Required</b></td>
  2613. </tr>
  2614. <tr>
  2615. <td valign="top">token</td>
  2616. <td valign="top">the token string without @</td>
  2617. <td align="center" valign="top">Yes*</td>
  2618. </tr>
  2619. <tr>
  2620. <td valign="top">value</td>
  2621. <td valign="top">the string that should be put to replace the token when the
  2622. file is copied</td>
  2623. <td align="center" valign="top">Yes*</td>
  2624. </tr>
  2625. <tr>
  2626. <td valign="top">filtersfile</td>
  2627. <td valign="top">The file from which the filters must be read. This file must be a formatted as a property file. </td>
  2628. <td align="center" valign="top">Yes*</td>
  2629. </tr>
  2630. </table>
  2631. <p>* see notes 1 and 2 above parameters table.</p>
  2632. <h3>Examples</h3>
  2633. <pre> &lt;filter token=&quot;year&quot; value=&quot;2000&quot;/&gt;
  2634. &lt;copy todir=&quot;${dest.dir}&quot;&gt;
  2635. &lt;fileset dir=&quot;${src.dir}&quot;/&gt;
  2636. &lt;/copy&gt;</pre>
  2637. <p>will copy recursively all the files from the <i>src.dir</i> directory into
  2638. the <i>dest.dir</i> directory replacing all the occurencies of the string <i>@year@</i>
  2639. with <i>2000.</i></p>
  2640. <pre> &lt;filter filterfile=&quot;deploy_env.properties&quot;/&gt;</pre>
  2641. will read all property entries from the <i>deploy_env.properties</i> file
  2642. and set these as filters.
  2643. <hr>
  2644. <h2><a name="fixcrlf">FixCRLF</a></h2>
  2645. <h3>Description</h3>
  2646. <p>Adjusts a text file to local.</p>
  2647. <p>It is possible to refine the set of files that are being adjusted. This can be
  2648. done with the <i>includes</i>, <i>includesfile</i>, <i>excludes</i>, <i>excludesfile</i> and <i>defaultexcludes</i>
  2649. attributes. With the <i>includes</i> or <i>includesfile</i> attribute you specify the files you want to
  2650. have included by using patterns. The <i>exclude</i> or <i>excludesfile</i> attribute is used to specify
  2651. the files you want to have excluded. This is also done with patterns. And
  2652. finally with the <i>defaultexcludes</i> attribute, you can specify whether you
  2653. want to use default exclusions or not. See the section on <a
  2654. href="#directorybasedtasks">directory based tasks</a>, on how the
  2655. inclusion/exclusion of files works, and how to write patterns.</p>
  2656. <p>This task forms an implicit <a href="#fileset">FileSet</a> and
  2657. supports all attributes of <code>&lt;fileset&gt;</code>
  2658. (<code>dir</code> becomes <code>srcdir</code>) as well as the nested
  2659. <code>&lt;include&gt;</code>, <code>&lt;exclude&gt;</code> and
  2660. <code>&lt;patternset&gt;</code> elements.</p>
  2661. <h3>Parameters</h3>
  2662. <table border="1" cellpadding="2" cellspacing="0">
  2663. <tr>
  2664. <td valign="top"><b>Attribute</b></td>
  2665. <td valign="top"><b>Description</b></td>
  2666. <td align="center" valign="top"><b>Required</b></td>
  2667. </tr>
  2668. <tr>
  2669. <td valign="top">srcDir</td>
  2670. <td valign="top">Where to find the files to be fixed up.</td>
  2671. <td valign="top" align="center">Yes</td>
  2672. </tr>
  2673. <tr>
  2674. <td valign="top">destDir</td>
  2675. <td valign="top">Where to place the corrected files. Defaults to
  2676. srcDir (replacing the original file)</td>
  2677. <td valign="top" align="center">No</td>
  2678. </tr>
  2679. <tr>
  2680. <td valign="top">includes</td>
  2681. <td valign="top">comma separated list of patterns of files that must be
  2682. included. All files are included when omitted.</td>
  2683. <td valign="top" align="center">No</td>
  2684. </tr>
  2685. <tr>
  2686. <td valign="top">includesfile</td>
  2687. <td valign="top">the name of a file. Each line of this file is
  2688. taken to be an include pattern</td>
  2689. <td valign="top" align="center">No</td>
  2690. </tr>
  2691. <tr>
  2692. <td valign="top">excludes</td>
  2693. <td valign="top">comma separated list of patterns of files that must be
  2694. excluded. No files (except default excludes) are excluded when omitted.</td>
  2695. <td valign="top" align="center">No</td>
  2696. </tr>
  2697. <tr>
  2698. <td valign="top">excludesfile</td>
  2699. <td valign="top">the name of a file. Each line of this file is
  2700. taken to be an exclude pattern</td>
  2701. <td valign="top" align="center">No</td>
  2702. </tr>
  2703. <tr>
  2704. <td valign="top">defaultexcludes</td>
  2705. <td valign="top">indicates whether default excludes should be used or not
  2706. (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when omitted.</td>
  2707. <td valign="top" align="center">No</td>
  2708. </tr>
  2709. <tr>
  2710. <td valign="top">cr</td>
  2711. <td valign="top">Specifies how carriage return (CR) characters are to
  2712. be handled. Valid values for this property are:
  2713. <ul>
  2714. <li>add: ensure that there is a CR before every LF
  2715. <li>asis: leave CR characters alone
  2716. <li>remove: remove all CR characters
  2717. </ul>
  2718. Default is based on the platform on which you are running this task.
  2719. For Unix platforms, the default is remove. For DOS based systems
  2720. (including Windows), the default is add.
  2721. <p>
  2722. Note: Unless this property is specified as &quot;asis&quot;, extra CR characters
  2723. which do not precede a LF will be removed.
  2724. </td>
  2725. <td valign="top" align="center">No</td>
  2726. </tr>
  2727. <tr>
  2728. <td valign="top">tab</td>
  2729. <td valign="top">Specifies how tab characters are to be handled. Valid
  2730. values for this property are:
  2731. <ul>
  2732. <li>add: convert sequences of spaces which span a tab stop to tabs
  2733. <li>asis: leave tab and space characters alone
  2734. <li>remove: convert tabs to spaces
  2735. </ul>
  2736. Default for this parameter is &quot;asis&quot;.
  2737. <p>
  2738. Note: Unless this property is specified as &quot;asis&quot;, extra spaces and
  2739. tabs after the last non-whitespace character on the line will be removed.
  2740. </td>
  2741. <td valign="top" align="center">No</td>
  2742. </tr>
  2743. <tr>
  2744. <td valign="top">tablength</td>
  2745. <td valign="top">The number of characters a TAB stop corresponds to.
  2746. Must be a positive power of 2, default for this parameter is 8.</td>
  2747. <td valign="top" align="center">No</td>
  2748. </tr>
  2749. <tr>
  2750. <td valign="top">eof</td>
  2751. <td valign="top">Specifies how DOS end of file (control-Z) characters are
  2752. to be handled. Valid values for this property are:
  2753. <ul>
  2754. <li>add: ensure that there is an EOF character at the end of the file
  2755. <li>asis: leave EOF characters alone
  2756. <li>remove: remove any EOF character found at the end
  2757. </ul>
  2758. Default is based on the platform on which you are running this task.
  2759. For Unix platforms, the default is remove. For DOS based systems
  2760. (including Windows), the default is asis.
  2761. </td>
  2762. <td valign="top" align="center">No</td>
  2763. </tr>
  2764. </table>
  2765. <h3>Examples</h3>
  2766. <pre> &lt;fixcrlf srcdir=&quot;${src}&quot;
  2767. cr=&quot;remove&quot; eof=&quot;remove&quot;
  2768. includes=&quot;**/*.sh&quot;
  2769. /&gt;</pre>
  2770. <p>Removes carriage return and eof characters from the shell scripts. Tabs and
  2771. spaces are left as is.
  2772. <pre> &lt;fixcrlf srcdir=&quot;${src}&quot;
  2773. cr=&quot;add&quot;
  2774. includes=&quot;**/*.bat&quot;
  2775. /&gt;</pre>
  2776. <p>Ensures that there are carriage return characters prior to evey line feed.
  2777. Tabs and spaces are left as is.
  2778. EOF characters are left alone if run on
  2779. DOS systems, and are removed if run on Unix systems.</p>
  2780. <pre> &lt;fixcrlf srcdir=&quot;${src}&quot;
  2781. tabs=&quot;add&quot;
  2782. includes=&quot;**/Makefile&quot;
  2783. /&gt;</pre>
  2784. <p>Adds or removes CR characters to match local OS conventions, and
  2785. converts spaces to tabs when appropriate. EOF characters are left alone if
  2786. run on DOS systems, and are removed if run on Unix systems.
  2787. Many versions of make require tabs prior to commands.</p>
  2788. <pre> &lt;fixcrlf srcdir=&quot;${src}&quot;
  2789. tabs=&quot;remove&quot;
  2790. includes=&quot;**/README*&quot;
  2791. /&gt;</pre>
  2792. <p>Adds or removes CR characters to match local OS conventions, and
  2793. converts all tabs to spaces. EOF characters are left alone if run on
  2794. DOS systems, and are removed if run on Unix systems.
  2795. You never know what editor a user will use to browse README's.</p>
  2796. <hr>
  2797. <h2><a name="genkey">GenKey</a></h2>
  2798. <h3>Description</h3>
  2799. <p>Generates a key in keystore.</p>
  2800. <h3>Parameters</h3>
  2801. <table border="1" cellpadding="2" cellspacing="0">
  2802. <tr>
  2803. <td valign="top"><b>Attribute</b></td>
  2804. <td valign="top"><b>Description</b></td>
  2805. <td align="center" valign="top"><b>Required</b></td>
  2806. </tr>
  2807. <tr>
  2808. <td valign="top">alias</td>
  2809. <td valign="top">the alias to add under</td>
  2810. <td valign="top" align="center">Yes.</td>
  2811. </tr>
  2812. <tr>
  2813. <td valign="top">storepass</td>
  2814. <td valign="top">password for keystore integrity.</td>
  2815. <td valign="top" align="center">Yes.</td>
  2816. </tr>
  2817. <tr>
  2818. <td valign="top">keystore</td>
  2819. <td valign="top">keystore location</td>
  2820. <td valign="top" align="center">No</td>
  2821. </tr>
  2822. <tr>
  2823. <td valign="top">storetype</td>
  2824. <td valign="top">keystore type</td>
  2825. <td valign="top" align="center">No</td>
  2826. </tr>
  2827. <tr>
  2828. <td valign="top">keypass</td>
  2829. <td valign="top">password for private key (if different)</td>
  2830. <td valign="top" align="center">No</td>
  2831. </tr>
  2832. <tr>
  2833. <td valign="top">sigalg</td>
  2834. <td valign="top">the algorithm to use in signing</td>
  2835. <td valign="top" align="center">No</td>
  2836. </tr>
  2837. <tr>
  2838. <td valign="top">keyalg</td>
  2839. <td valign="top">the method to use when generating name-value pair</td>
  2840. <td valign="top" align="center">No</td>
  2841. </tr>
  2842. <tr>
  2843. <td valign="top">verbose</td>
  2844. <td valign="top">(true | false) verbose output when signing</td>
  2845. <td valign="top" align="center">No</td>
  2846. </tr>
  2847. <tr>
  2848. <td valign="top">dname</td>
  2849. <td valign="top">The distinguished name for entity</td>
  2850. <td valign="top" align="center">Yes if dname element unspecified</td>
  2851. </tr>
  2852. <tr>
  2853. <td valign="top">validity</td>
  2854. <td valign="top">(integer) indicates how many days certificate is valid</td>
  2855. <td valign="top" align="center">No</td>
  2856. </tr>
  2857. <tr>
  2858. <td valign="top">keysize</td>
  2859. <td valign="top">(integer) indicates the size of key generated</td>
  2860. <td valign="top" align="center">No</td>
  2861. </tr>
  2862. </table>
  2863. <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
  2864. <p>The following two examples are identical: </p>
  2865. <h3>Examples</h3>
  2866. <blockquote>
  2867. <p><code>&lt;genkey alias=&quot;apache-group&quot; storepass=&quot;secret&quot;
  2868. dname=&quot;CN=Ant Group, OU=Jakarta Division, O=Apache.org, C=US&quot;/&gt;</code></p>
  2869. </blockquote>
  2870. <blockquote>
  2871. <pre><code>&lt;genkey alias=&quot;apache-group&quot; storepass=&quot;secret&quot; &gt;
  2872. &lt;dname&gt;
  2873. &lt;param name=&quot;CN&quot; value=&quot;Ant Group&quot;/&gt;
  2874. &lt;param name=&quot;OU&quot; value=&quot;Jakarta Division&quot;/&gt;
  2875. &lt;param name=&quot;O&quot; value=&quot;Apache.Org&quot;/&gt;
  2876. &lt;param name=&quot;C&quot; value=&quot;US&quot;/&gt;
  2877. &lt;/dname&gt;
  2878. &lt;/genkey&gt;</code></pre>
  2879. </blockquote>
  2880. <hr>
  2881. <h2><a name="get">Get</a></h2>
  2882. <h3>Description</h3>
  2883. <p>Gets a file from a URL. When the verbose option is &quot;on&quot;, this task
  2884. displays a '.' for every 100 Kb retrieved.</p>
  2885. <p>This task should be preferred above the <a href="#cvs">CVS task</a> when
  2886. doing automated builds. CVS is significantly slower than loading a compressed
  2887. archive with http/ftp.</p>
  2888. The <i>usetimestamp</i> option enables you to control downloads so that the remote file is
  2889. only fetched if newer than the local copy. If there is no local copy, the download always takes
  2890. place. When a file is downloaded, the timestamp of the downloaded file is set to the remote timestamp,
  2891. if the JVM is Java1.2 or later.
  2892. NB: This timestamp facility only works on downloads using the HTTP protocol.
  2893. <h3>Parameters</h3>
  2894. <table border="1" cellpadding="2" cellspacing="0">
  2895. <tr>
  2896. <td valign="top"><b>Attribute</b></td>
  2897. <td valign="top"><b>Description</b></td>
  2898. <td align="center" valign="top"><b>Required</b></td>
  2899. </tr>
  2900. <tr>
  2901. <td valign="top">src</td>
  2902. <td valign="top">the URL from which to retrieve a file.</td>
  2903. <td align="center" valign="top">Yes</td>
  2904. </tr>
  2905. <tr>
  2906. <td valign="top">dest</td>
  2907. <td valign="top">the file where to store the retrieved file.</td>
  2908. <td align="center" valign="top">Yes</td>
  2909. </tr>
  2910. <tr>
  2911. <td valign="top">verbose</td>
  2912. <td valign="top">show verbose progress information (&quot;on&quot;/&quot;off&quot;).</td>
  2913. <td align="center" valign="top">No</td>
  2914. </tr>
  2915. <tr>
  2916. <td valign="top">ignoreerrors</td>
  2917. <td valign="top">Log errors but don't treat as fatal.</td>
  2918. <td align="center" valign="top">No</td>
  2919. </tr>
  2920. <tr>
  2921. <td valign="top">usetimestamp</td>
  2922. <td valign="top">conditionally download a file based on the timestamp of the local copy.
  2923. HTTP only</td>
  2924. <td align="center" valign="top">No</td>
  2925. </tr>
  2926. </table>
  2927. <h3>Examples</h3>
  2928. <pre> &lt;get src=&quot;http://jakarta.apache.org/&quot; dest=&quot;help/index.html&quot;/&gt;</pre>
  2929. <p>Gets the index page of http://jakarta.apache.org/, and stores it in the file <code>help/index.html</code>.</p>
  2930. <pre> &lt;get src=&quot;http://jakarta.apache.org/builds/tomcat/nightly/ant.zip&quot;
  2931. dest=&quot;optional.jar&quot;
  2932. verbose=&quot;true&quot;
  2933. usetimestamp=&quot;true&quot;/&gt;</pre>
  2934. <p>
  2935. Gets the nightly ant build from the tomcat distribution, if the local copy
  2936. is missing or out of date. Uses the verbose option
  2937. for progress information.
  2938. </p>
  2939. <hr>
  2940. <h2><a name="gunzip">GUnzip</a></h2>
  2941. <h3>Description</h3>
  2942. <p>Expands a GZip file.</p>
  2943. <p>If <i>dest</i> is a directory the name of the destination file is
  2944. the same as <i>src</i> (with the &quot;.gz&quot; extension removed if
  2945. present). If <i>dest</i> is omitted, the parent dir of <i>src</i> is
  2946. taken. The file is only expanded if the source file is newer than the
  2947. destination file, or when the destination file does not exist.</p>
  2948. <h3>Parameters</h3>
  2949. <table border="1" cellpadding="2" cellspacing="0">
  2950. <tr>
  2951. <td valign="top"><b>Attribute</b></td>
  2952. <td valign="top"><b>Description</b></td>
  2953. <td align="center" valign="top"><b>Required</b></td>
  2954. </tr>
  2955. <tr>
  2956. <td valign="top">src</td>
  2957. <td valign="top">the file to expand.</td>
  2958. <td align="center" valign="top">Yes</td>
  2959. </tr>
  2960. <tr>
  2961. <td valign="top">dest</td>
  2962. <td valign="top">the destination file or directory.</td>
  2963. <td align="center" valign="top">No</td>
  2964. </tr>
  2965. </table>
  2966. <h3>Examples</h3>
  2967. <blockquote>
  2968. <p><code>&lt;gunzip src=&quot;test.tar.gz&quot;/&gt;</code></p>
  2969. </blockquote>
  2970. <p>expands <i>test.tar.gz</i> to <i>test.tar</i></p>
  2971. <blockquote>
  2972. <p><code>&lt;gunzip src=&quot;test.tar.gz&quot; dest=&quot;test2.tar&quot;/&gt;</code></p>
  2973. </blockquote>
  2974. <p>expands <i>test.tar.gz</i> to <i>test2.tar</i></p>
  2975. <blockquote>
  2976. <p><code>&lt;gunzip src=&quot;test.tar.gz&quot; dest=&quot;subdir&quot;/&gt;</code></p>
  2977. </blockquote>
  2978. <p>expands <i>test.tar.gz</i> to <i>subdir/test.tar</i> (assuming
  2979. subdir is a directory).</p>
  2980. <hr>
  2981. <h2><a name="gzip">GZip</a></h2>
  2982. <h3>Description</h3>
  2983. <p>GZips a file.</p>
  2984. <h3>Parameters</h3>
  2985. <table border="1" cellpadding="2" cellspacing="0">
  2986. <tr>
  2987. <td valign="top"><b>Attribute</b></td>
  2988. <td valign="top"><b>Description</b></td>
  2989. <td align="center" valign="top"><b>Required</b></td>
  2990. </tr>
  2991. <tr>
  2992. <td valign="top">src</td>
  2993. <td valign="top">the file to gzip.</td>
  2994. <td align="center" valign="top">Yes</td>
  2995. </tr>
  2996. <tr>
  2997. <td valign="top">zipfile</td>
  2998. <td valign="top">the destination file.</td>
  2999. <td align="center" valign="top">Yes</td>
  3000. </tr>
  3001. </table>
  3002. <h3>Examples</h3>
  3003. <blockquote>
  3004. <p><code>&lt;gzip src=&quot;test.tar&quot; zipfile=&quot;test.tar.gz&quot;
  3005. /&gt;</code></p>
  3006. </blockquote>
  3007. <hr>
  3008. <h2><a name="jar">Jar</a></h2>
  3009. <h3>Description</h3>
  3010. <p>Jars a set of files.</p>
  3011. <p>The <i>basedir</i> attribute is the reference directory from where to jar.</p>
  3012. <p>Note that file permissions will not be stored in the resulting jarfile.</p>
  3013. <p>It is possible to refine the set of files that are being jarred. This can be
  3014. done with the <i>includes</i>, <i>includesfile</i>, <i>excludes</i>, <i>excludesfile</i> and <i>defaultexcludes</i>
  3015. attributes. With the <i>includes</i> or <i>includesfile</i> attribute you specify the files you want to
  3016. have included by using patterns. The <i>exclude</i> or <i>excludesfile</i> attribute is used to specify
  3017. the files you want to have excluded. This is also done with patterns. And
  3018. finally with the <i>defaultexcludes</i> attribute, you can specify whether you
  3019. want to use default exclusions or not. See the section on <a
  3020. href="#directorybasedtasks">directory based tasks</a>, on how the
  3021. inclusion/exclusion of files works, and how to write patterns.</p>
  3022. <p>This task forms an implicit <a href="#fileset">FileSet</a> and
  3023. supports all attributes of <code>&lt;fileset&gt;</code>
  3024. (<code>dir</code> becomes <code>basedir</code>) as well as the nested
  3025. <code>&lt;include&gt;</code>, <code>&lt;exclude&gt;</code> and
  3026. <code>&lt;patternset&gt;</code> elements.</p>
  3027. <p>You can also use nested file sets for more flexibility, and specify
  3028. multiple ones to merge together different trees of files into one JAR.
  3029. The extended fileset attributes from the zip task are also available
  3030. in the jar task.
  3031. See the <a href="#zip">Zip</a> task for more details and examples.</p>
  3032. <p>If the manifest is omitted, a simple one will be supplied by Ant.
  3033. You should not include <samp>META-INF/MANIFEST.MF</samp> in your set of files.
  3034. <p>The <code>whenempty</code> parameter controls what happens when no files match.
  3035. If <code>create</code> (the default), the JAR is created anyway with only a manifest.
  3036. If <code>skip</code>, the JAR is not created and a warning is issued.
  3037. If <code>fail</code>, the JAR is not created and the build is halted with an error.
  3038. <p>(The Jar task is a shortcut for specifying the manifest file of a JAR file.
  3039. The same thing can be accomplished by using the <i>fullpath</i>
  3040. attribute of a zipfileset in a Zip task. The one difference is that if the
  3041. <i>manifest</i> attribute is not specified, the Jar task will
  3042. include an empty one for you.)</p>
  3043. </p>
  3044. <h3>Parameters</h3>
  3045. <table border="1" cellpadding="2" cellspacing="0">
  3046. <tr>
  3047. <td valign="top"><b>Attribute</b></td>
  3048. <td valign="top"><b>Description</b></td>
  3049. <td align="center" valign="top"><b>Required</b></td>
  3050. </tr>
  3051. <tr>
  3052. <td valign="top">jarfile</td>
  3053. <td valign="top">the jar-file to create.</td>
  3054. <td valign="top" align="center">Yes</td>
  3055. </tr>
  3056. <tr>
  3057. <td valign="top">basedir</td>
  3058. <td valign="top">the directory from which to jar the files.</td>
  3059. <td valign="top" align="center">No</td>
  3060. </tr>
  3061. <tr>
  3062. <td valign="top">compress</td>
  3063. <td valign="top">Not only store data but also compress them, defaults to true</td>
  3064. <td align="center" valign="top">No</td>
  3065. </tr>
  3066. <tr>
  3067. <td valign="top">includes</td>
  3068. <td valign="top">comma separated list of patterns of files that must be
  3069. included. All files are included when omitted.</td>
  3070. <td valign="top" align="center">No</td>
  3071. </tr>
  3072. <tr>
  3073. <td valign="top">includesfile</td>
  3074. <td valign="top">the name of a file. Each line of this file is
  3075. taken to be an include pattern</td>
  3076. <td valign="top" align="center">No</td>
  3077. </tr>
  3078. <tr>
  3079. <td valign="top">excludes</td>
  3080. <td valign="top">comma separated list of patterns of files that must be
  3081. excluded. No files (except default excludes) are excluded when omitted.</td>
  3082. <td valign="top" align="center">No</td>
  3083. </tr>
  3084. <tr>
  3085. <td valign="top">excludesfile</td>
  3086. <td valign="top">the name of a file. Each line of this file is
  3087. taken to be an exclude pattern</td>
  3088. <td valign="top" align="center">No</td>
  3089. </tr>
  3090. <tr>
  3091. <td valign="top">defaultexcludes</td>
  3092. <td valign="top">indicates whether default excludes should be used or not
  3093. (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when omitted.</td>
  3094. <td valign="top" align="center">No</td>
  3095. </tr>
  3096. <tr>
  3097. <td valign="top">manifest</td>
  3098. <td valign="top">the manifest file to use.</td>
  3099. <td valign="top" align="center">No</td>
  3100. </tr>
  3101. <tr>
  3102. <td valign="top">whenempty</td>
  3103. <td valign="top">Behavior to use if no files match.</td>
  3104. <td valign="top" align="center">No</td>
  3105. </tr>
  3106. </table>
  3107. <h3>Examples</h3>
  3108. <pre> &lt;jar jarfile=&quot;${dist}/lib/app.jar&quot; basedir=&quot;${build}/classes&quot;/&gt;</pre>
  3109. <p>jars all files in the <code>${build}/classes</code> directory into a file
  3110. called <code>app.jar</code> in the <code>${dist}/lib</code> directory.</p>
  3111. <pre> &lt;jar jarfile=&quot;${dist}/lib/app.jar&quot;
  3112. basedir=&quot;${build}/classes&quot;
  3113. excludes=&quot;**/Test.class&quot;
  3114. /&gt;</pre>
  3115. <p>jars all files in the <code>${build}/classes</code> directory into a file
  3116. called <code>app.jar</code> in the <code>${dist}/lib</code> directory. Files
  3117. with the name <code>Test.class</code> are excluded.</p>
  3118. <pre> &lt;jar jarfile=&quot;${dist}/lib/app.jar&quot;
  3119. basedir=&quot;${build}/classes&quot;
  3120. includes=&quot;mypackage/test/**&quot;
  3121. excludes=&quot;**/Test.class&quot;
  3122. /&gt;</pre>
  3123. <p>jars all files in the <code>${build}/classes</code> directory into a file
  3124. called <code>app.jar</code> in the <code>${dist}/lib</code> directory. Only
  3125. files under the directory <code>mypackage/test</code> are used, and files with
  3126. the name <code>Test.class</code> are excluded.</p>
  3127. <pre> &lt;jar jarfile=&quot;${dist}/lib/app.jar&quot;&gt;
  3128. &lt;fileset dir=&quot;${build}/classes&quot;
  3129. excludes=&quot;**/Test.class&quot;
  3130. /&gt;
  3131. &lt;fileset dir=&quot;${src}/resources&quot;/&gt;
  3132. &lt;/jar&gt;</pre>
  3133. <p>jars all files in the <code>${build}/classes</code> directory and also
  3134. in the <code>${src}/resources</code> directory together into a file
  3135. called <code>app.jar</code> in the <code>${dist}/lib</code> directory.
  3136. Files with the name <code>Test.class</code> are excluded.
  3137. If there are files such as <code>${build}/classes/mypackage/MyClass.class</code>
  3138. and <code>${src}/resources/mypackage/image.gif</code>, they will appear
  3139. in the same directory in the JAR (and thus be considered in the same package
  3140. by Java).</p>
  3141. <hr>
  3142. <h2><a name="java">Java</a></h2>
  3143. <h3>Description</h3>
  3144. <p>Executes a Java class within the running (Ant) VM or forks another VM if
  3145. specified.</p>
  3146. <p>Be careful that the executed class doesn't call System.exit(), because it
  3147. will terminate the VM and thus Ant. In case this happens, it's highly suggested
  3148. that you set the fork attribute so that System.exit() stops the other VM and not
  3149. the one that is currently running Ant.</p>
  3150. <h3>Parameters</h3>
  3151. <table border="1" cellpadding="2" cellspacing="0">
  3152. <tr>
  3153. <td valign="top"><b>Attribute</b></td>
  3154. <td valign="top"><b>Description</b></td>
  3155. <td align="center" valign="top"><b>Required</b></td>
  3156. </tr>
  3157. <tr>
  3158. <td valign="top">classname</td>
  3159. <td valign="top">the Java class to execute.</td>
  3160. <td align="center" valign="top">Yes</td>
  3161. </tr>
  3162. <tr>
  3163. <td valign="top">args</td>
  3164. <td valign="top">the arguments for the class that is
  3165. executed. <b>deprecated, use nested <code>&lt;arg&gt;</code>
  3166. elements instead.</b></td>
  3167. <td align="center" valign="top">No</td>
  3168. </tr>
  3169. <tr>
  3170. <td valign="top">classpath</td>
  3171. <td valign="top">the classpath to use.</td>
  3172. <td align="center" valign="top">No</td>
  3173. </tr>
  3174. <tr>
  3175. <td valign="top">classpathref</td>
  3176. <td valign="top">the classpath to use, given as <a
  3177. href="#references">reference</a> to a PATH defined elsewhere.</td>
  3178. <td align="center" valign="top">No</td>
  3179. </tr>
  3180. <tr>
  3181. <td valign="top">fork</td>
  3182. <td valign="top">if enabled triggers the class execution in another VM
  3183. (disabled by default)</td>
  3184. <td align="center" valign="top">No</td>
  3185. </tr>
  3186. <tr>
  3187. <td valign="top">jvm</td>
  3188. <td valign="top">the command used to invoke the Java Virtual Machine,
  3189. default is 'java'. The command is resolved by java.lang.Runtime.exec().
  3190. Ignored if fork is disabled.
  3191. </td>
  3192. <td align="center" valign="top">No</td>
  3193. </tr>
  3194. <tr>
  3195. <td valign="top">jvmargs</td>
  3196. <td valign="top">the arguments to pass to the forked VM (ignored
  3197. if fork is disabled). <b>deprecated, use nested
  3198. <code>&lt;jvmarg&gt;</code> elements instead.</b></td>
  3199. <td align="center" valign="top">No</td>
  3200. </tr>
  3201. <tr>
  3202. <td valign="top">maxmemory</td>
  3203. <td valign="top">Max amount of memory to allocate to the forked VM
  3204. (ignored if fork is disabled)</td>
  3205. <td align="center" valign="top">No</td>
  3206. </tr>
  3207. <tr>
  3208. <td valign="top">failonerror</td>
  3209. <td valign="top">Stop the buildprocess if the command exits with a
  3210. returncode other than 0. Only available if fork is true.</td>
  3211. <td align="center" valign="top">No</td>
  3212. </tr>
  3213. <tr>
  3214. <td valign="top">dir</td>
  3215. <td valign="top">The directory to invoke the VM in. (ignored if
  3216. fork is disabled)</td>
  3217. <td align="center" valign="top">No</td>
  3218. </tr>
  3219. <tr>
  3220. <td valign="top">output</td>
  3221. <td valign="top">Name of a file to write the output to.</td>
  3222. <td align="center" valign="top">No</td>
  3223. </tr>
  3224. </table>
  3225. <h3>Parameters specified as nested elements</h3>
  3226. <h4>arg and jvmarg</h4>
  3227. <p>Use nested <code>&lt;arg&gt;</code> and <code>&lt;jvmarg&gt;</code>
  3228. elements to specify arguments for the or the forked VM. See <a
  3229. href="index.html#arg">Command line arguments</a>.</p>
  3230. <h4>sysproperty</h4>
  3231. <p>Use nested <code>&lt;sysproperty&gt;</code>
  3232. elements to specify system properties required by the class.
  3233. These properties will be made available to the VM during the execution
  3234. of the class (either ANT's VM or the forked VM). The attributes
  3235. for this element are the same as for <a href="index.html#env">environment
  3236. variables</a>.</p>
  3237. <h4>classpath</h4>
  3238. <p><code>Java</code>'s <i>classpath</i> attribute is a <a
  3239. href="#path">PATH like structure</a> and can also be set via a nested
  3240. <i>classpath</i> element.</p>
  3241. <h5>Example</h5>
  3242. <pre>
  3243. &lt;java classname=&quot;test.Main&quot; &gt;
  3244. &lt;arg value=&quot;-h&quot;/&gt;
  3245. &lt;classpath&gt;
  3246. &lt;pathelement location=&quot;\test.jar&quot;/&gt;
  3247. &lt;pathelement path=&quot;${java.class.path}&quot;/&gt;
  3248. &lt;/classpath&gt;
  3249. &lt;/java&gt;
  3250. </pre>
  3251. <h3>Examples</h3>
  3252. <pre> &lt;java classname=&quot;test.Main&quot;/&gt;</pre>
  3253. <pre> &lt;java classname=&quot;test.Main&quot;
  3254. fork=&quot;yes&quot; &gt;
  3255. &lt;sysproperty key=&quot;DEBUG&quot; value=&quot;true&quot;/&gt;
  3256. &lt;arg value=&quot;-h&quot;/&gt;
  3257. &lt;jvmarg value=&quot;-Xrunhprof:cpu=samples,file=log.txt,depth=3&quot;/&gt;
  3258. &lt;/java&gt;
  3259. </pre>
  3260. <hr>
  3261. <h2><a name="javac">Javac</a></h2>
  3262. <h3>Description</h3>
  3263. <p>Compiles a source tree within the running (Ant) VM.</p>
  3264. <p>The source and destination directory will be recursively scanned for Java
  3265. source files to compile. Only Java files that have no corresponding class file
  3266. or where the class file is older than the java file will be compiled.</p>
  3267. <p>The directory structure of the source tree should follow the package
  3268. hierarchy.</p>
  3269. <p>It is possible to refine the set of files that are being compiled/copied.
  3270. This can be done with the <i>includes</i>, <i>includesfile</i>, <i>excludes</i>, <i>excludesfile</i> and <i>defaultexcludes</i>
  3271. attributes. With the <i>includes</i> or <i>includesfile</i> attribute you specify the files you want to
  3272. have included by using patterns. The <i>exclude</i> or <i>excludesfile</i> attribute is used to specify
  3273. the files you want to have excluded. This is also done with patterns. And
  3274. finally with the <i>defaultexcludes</i> attribute, you can specify whether you
  3275. want to use default exclusions or not. See the section on <a
  3276. href="#directorybasedtasks">directory based tasks</a>, on how the
  3277. inclusion/exclusion of files works, and how to write patterns.</p>
  3278. <p>It is possible to use different compilers. This can be selected with the
  3279. &quot;build.compiler&quot; property. There are four choices:</p>
  3280. <ul>
  3281. <li>classic (the standard compiler of JDK 1.1/1.2)</li>
  3282. <li>modern (the new compiler of JDK 1.3)</li>
  3283. <li>jikes (the <a
  3284. href="http://oss.software.ibm.com/developerworks/opensource/jikes/project">Jikes</a>
  3285. compiler)</li>
  3286. <li>jvc (the Command-Line Compiler from Microsoft's SDK for Java /
  3287. Visual J++)</li>
  3288. </ul>
  3289. <p>For JDK 1.1/1.2, classic is the default. For JDK 1.3, modern is the default.
  3290. If you wish to use a different compiler interface than one of the four
  3291. supplied, write a class that implements the CompilerAdapter interface
  3292. (package org.apache.tools.ant.taskdefs.compilers). Supply the full
  3293. classname in the &quot;build.compiler&quot; property.
  3294. </p>
  3295. <h3>Parameters</h3>
  3296. <table border="1" cellpadding="2" cellspacing="0">
  3297. <tr>
  3298. <td valign="top"><b>Attribute</b></td>
  3299. <td valign="top"><b>Description</b></td>
  3300. <td align="center" valign="top"><b>Required</b></td>
  3301. </tr>
  3302. <tr>
  3303. <td valign="top">srcdir</td>
  3304. <td valign="top">location of the java files.</td>
  3305. <td align="center" valign="top">Yes, unless nested <code>&lt;src&gt;</code> elements are present.</td>
  3306. </tr>
  3307. <tr>
  3308. <td valign="top">destdir</td>
  3309. <td valign="top">location to store the class files.</td>
  3310. <td align="center" valign="top">No</td>
  3311. </tr>
  3312. <tr>
  3313. <td valign="top">includes</td>
  3314. <td valign="top">comma-separated list of patterns of files that must be
  3315. included; all files are included when omitted.</td>
  3316. <td valign="top" align="center">No</td>
  3317. </tr>
  3318. <tr>
  3319. <td valign="top">includesfile</td>
  3320. <td valign="top">the name of a file that contains
  3321. include patterns.</td>
  3322. <td valign="top" align="center">No</td>
  3323. </tr>
  3324. <tr>
  3325. <td valign="top">excludes</td>
  3326. <td valign="top">comma-separated list of patterns of files that must be
  3327. excluded; no files (except default excludes) are excluded when omitted.</td>
  3328. <td valign="top" align="center">No</td>
  3329. </tr>
  3330. <tr>
  3331. <td valign="top">excludesfile</td>
  3332. <td valign="top">the name of a file that contains
  3333. exclude patterns.</td>
  3334. <td valign="top" align="center">No</td>
  3335. </tr>
  3336. <tr>
  3337. <td valign="top">defaultexcludes</td>
  3338. <td valign="top">indicates whether default excludes should be used
  3339. (<code>yes</code> | <code>no</code>); default excludes are used when omitted.</td>
  3340. <td valign="top" align="center">No</td>
  3341. </tr>
  3342. <tr>
  3343. <td valign="top">classpath</td>
  3344. <td valign="top">the classpath to use.</td>
  3345. <td align="center" valign="top">No</td>
  3346. </tr>
  3347. <tr>
  3348. <td valign="top">bootclasspath</td>
  3349. <td valign="top">location of bootstrap class files.</td>
  3350. <td align="center" valign="top">No</td>
  3351. </tr>
  3352. <tr>
  3353. <td valign="top">classpathref</td>
  3354. <td valign="top">the classpath to use, given as a
  3355. <a href="#references">reference</a> to a PATH defined elsewhere.</td>
  3356. <td align="center" valign="top">No</td>
  3357. </tr>
  3358. <tr>
  3359. <td valign="top">bootclasspathref</td>
  3360. <td valign="top">location of bootstrap class files, given as a
  3361. <a href="#references">reference</a> to a PATH defined elsewhere.</td>
  3362. <td align="center" valign="top">No</td>
  3363. </tr>
  3364. <tr>
  3365. <td valign="top">extdirs</td>
  3366. <td valign="top">location of installed extensions.</td>
  3367. <td align="center" valign="top">No</td>
  3368. </tr>
  3369. <tr>
  3370. <td valign="top">encoding</td>
  3371. <td valign="top">encoding of source files.</td>
  3372. <td align="center" valign="top">No</td>
  3373. </tr>
  3374. <tr>
  3375. <td valign="top">debug</td>
  3376. <td valign="top">indicates whether source should be compiled with debug
  3377. information; defaults to <code>off</code>.</td>
  3378. <td align="center" valign="top">No</td>
  3379. </tr>
  3380. <tr>
  3381. <td valign="top">optimize</td>
  3382. <td valign="top">indicates whether source should be compiled with
  3383. optimization; defaults to <code>off</code>.</td>
  3384. <td align="center" valign="top">No</td>
  3385. </tr>
  3386. <tr>
  3387. <td valign="top">deprecation</td>
  3388. <td valign="top">indicates whether source should be compiled with
  3389. deprecation information; defaults to <code>off</code>.</td>
  3390. <td align="center" valign="top">No</td>
  3391. </tr>
  3392. <tr>
  3393. <td valign="top">target</td>
  3394. <td valign="top">generate class files for specific VM version (e.g.,
  3395. <code>1.1</code> or <code>1.2</code>).</td>
  3396. <td align="center" valign="top">No</td>
  3397. </tr>
  3398. <tr>
  3399. <td valign="top">verbose</td>
  3400. <td valign="top">asks the compiler for verbose output.</td>
  3401. <td align="center" valign="top">No</td>
  3402. </tr>
  3403. <tr>
  3404. <td valign="top">depend</td> <td valign="top">enables dependency-tracking
  3405. for compilers that support this (jikes and classic)</td>
  3406. <td align="center" valign="top">No</td>
  3407. </tr>
  3408. <tr>
  3409. <td valign="top">includeAntRuntime</td>
  3410. <td valign="top">whether to include the Ant run-time libraries;
  3411. defaults to <code>no</code>.</td>
  3412. <td align="center" valign="top">No</td>
  3413. </tr>
  3414. <tr>
  3415. <td valign="top">includeJavaRuntime</td>
  3416. <td valign="top">whether to include the default run-time
  3417. libraries from the executing VM; defaults to <code>no</code>.</td>
  3418. <td align="center" valign="top">No</td>
  3419. </tr>
  3420. <tr>
  3421. <td valign="top">failonerror</td> <td valign="top">
  3422. indicates whether the build will continue even if there are compilation errors; defaults to <code>true</code>.
  3423. </td>
  3424. <td align="center" valign="top">No</td>
  3425. </tr>
  3426. </table>
  3427. <h3>Parameters specified as nested elements</h3>
  3428. <p>This task forms an implicit <a href="#fileset">FileSet</a> and
  3429. supports all attributes of <code>&lt;fileset&gt;</code>
  3430. (<code>dir</code> becomes <code>srcdir</code>) as well as the nested
  3431. <code>&lt;include&gt;</code>, <code>&lt;exclude&gt;</code> and
  3432. <code>&lt;patternset&gt;</code> elements.</p>
  3433. <h4><code>src</code>, <code>classpath</code>, <code>bootclasspath</code> and <code>extdirs</code></h4>
  3434. <p><code>Javac</code>'s <i>srcdir</i>, <i>classpath</i>,
  3435. <i>bootclasspath</i> and <i>extdirs</i> attributes are <a
  3436. href="#path">path-like structures</a> and can also be set via nested
  3437. <code>&lt;src&gt</code>,
  3438. <code>&lt;classpath&gt</code>,
  3439. <code>&lt;bootclasspath&gt</code> and
  3440. <code>&lt;extdirs&gt</code> elements, respectively.</p>
  3441. <h3>Examples</h3>
  3442. <pre> &lt;javac srcdir=&quot;${src}&quot;
  3443. destdir=&quot;${build}&quot;
  3444. classpath=&quot;xyz.jar&quot;
  3445. debug=&quot;on&quot;
  3446. /&gt;</pre>
  3447. <p>compiles all <code>.java</code> files under the <code>${src}</code>
  3448. directory, and stores
  3449. the <code>.class</code> files in the <code>${build}</code> directory.
  3450. The classpath used contains <code>xyz.jar</code>, and debug information is on.</p>
  3451. <pre> &lt;javac srcdir=&quot;${src}&quot;
  3452. destdir=&quot;${build}&quot;
  3453. includes=&quot;mypackage/p1/**,mypackage/p2/**&quot;
  3454. excludes=&quot;mypackage/p1/testpackage/**&quot;
  3455. classpath=&quot;xyz.jar&quot;
  3456. debug=&quot;on&quot;
  3457. /&gt;</pre>
  3458. <p>compiles <code>.java</code> files under the <code>${src}</code>
  3459. directory, and stores the
  3460. <code>.class</code> files in the <code>${build}</code> directory.
  3461. The classpath used contains <code>xyz.jar</code>, and debug information is on.
  3462. Only files under <code>mypackage/p1</code> and <code>mypackage/p2</code> are
  3463. used. Files in the <code>mypackage/p1/testpackage</code> directory are excluded
  3464. from compilation.</p>
  3465. <pre> &lt;javac srcdir=&quot;${src}:${src2}&quot;
  3466. destdir=&quot;${build}&quot;
  3467. includes=&quot;mypackage/p1/**,mypackage/p2/**&quot;
  3468. excludes=&quot;mypackage/p1/testpackage/**&quot;
  3469. classpath=&quot;xyz.jar&quot;
  3470. debug=&quot;on&quot;
  3471. /&gt;</pre>
  3472. <p>is the same as the previous example, with the addition of a second
  3473. source path, defined by
  3474. the property <code>src2</code>. This can also be represented using nested
  3475. <code>&lt;src&gt;</code> elements as follows:
  3476. <pre> &lt;javac destdir=&quot;${build}&quot;
  3477. classpath=&quot;xyz.jar&quot;
  3478. debug=&quot;on&quot;&gt;
  3479. &lt;src path=&quot;${src}&quot;/&gt;
  3480. &lt;src path=&quot;${src2}&quot;/&gt;
  3481. &lt;include name=&quot;mypackage/p1/**&quot;/&gt;
  3482. &lt;include name=&quot;mypackage/p2/**&quot;/&gt;
  3483. &lt;exclude name=&quot;mypackage/p1/testpackage/**&quot;/&gt;
  3484. &lt;/javac&gt;</pre>
  3485. <p><b>Note:</b> If you are using Ant on Windows and a new DOS window pops up
  3486. for every use of an external compiler, this may be a problem of the JDK you are using.
  3487. This problem may occur with all JDKs &lt; 1.2.</p>
  3488. <hr>
  3489. <h2><a name="javadoc">Javadoc/Javadoc2</a></h2>
  3490. <h3>Description</h3>
  3491. <p>Generates code documentation using the javadoc tool.</p>
  3492. <p>The source directory will be recursively scanned for Java source files to process
  3493. but only those matching the inclusion rules will be passed to the javadoc tool. This
  3494. allows wildcards to be used to choose between package names, reducing verbosity
  3495. and management costs over time. This task, however, has no notion of
  3496. &quot;changed&quot; files, unlike the <a href="#javac">javac</a> task. This means
  3497. all packages will be processed each time this task is run. In general, however,
  3498. this task is used much less frequently.</p>
  3499. <p>This task works seamlessly between different javadoc versions (1.1 and 1.2),
  3500. with the obvious restriction that the 1.2 attributes will be ignored if run in a
  3501. 1.1 VM.</p>
  3502. <p>NOTE: since javadoc calls System.exit(), javadoc cannot be run inside the
  3503. same VM as ant without breaking functionality. For this reason, this task
  3504. always forks the VM. This overhead is not significant since javadoc is normally a heavy
  3505. application and will be called infrequently.</p>
  3506. <p>NOTE: the packagelist attribute allows you to specify the list of packages to
  3507. document outside of the Ant file. It's a much better practice to include everything
  3508. inside the build.xml file. This option was added in order to make it easier to
  3509. migrate from regular makefiles, where you would use this option of javadoc.
  3510. The packages listed in packagelist are not checked, so the task performs even
  3511. if some packages are missing or broken. Use this option if you wish to convert from
  3512. an existing makefile. Once things are running you should then switch to the regular
  3513. notation.
  3514. <p>DEPRECATION: the javadoc2 task simply points to the javadoc task and it's
  3515. there for back compatibility reasons. Since this task will be removed in future
  3516. versions, you are strongly encouraged to use <a href="#javadoc">javadoc</a>
  3517. instead.</p>
  3518. <h3>Parameters</h3>
  3519. <table border="1" cellpadding="2" cellspacing="0">
  3520. <tr>
  3521. <td valign="top"><b>Attribute</b></td>
  3522. <td valign="top"><b>Description</b></td>
  3523. <td align="center" valign="top"><b>Availability</b></td>
  3524. <td align="center" valign="top"><b>Required</b></td>
  3525. </tr>
  3526. <tr>
  3527. <td valign="top">sourcepath</td>
  3528. <td valign="top">Specify where to find source files</td>
  3529. <td align="center" valign="top">all</td>
  3530. <td align="center" rowspan="2">At least one of the two or nested
  3531. <code>&lt;sourcepath&gt;</code></td>
  3532. </tr>
  3533. <tr>
  3534. <td valign="top">sourcepathref</td>
  3535. <td valign="top">Specify where to find source files by <a
  3536. href="#references">reference</a> to a PATH defined elsewhere.</td>
  3537. <td align="center" valign="top">all</td>
  3538. </tr>
  3539. <tr>
  3540. <td valign="top">destdir</td>
  3541. <td valign="top">Destination directory for output files</td>
  3542. <td align="center" valign="top">all</td>
  3543. <td align="center" valign="top">Yes</td>
  3544. </tr>
  3545. <tr>
  3546. <td valign="top">maxmemory</td>
  3547. <td valign="top">Max amount of memory to allocate to the javadoc VM</td>
  3548. <td align="center" valign="top">all</td>
  3549. <td align="center" valign="top">No</td>
  3550. </tr>
  3551. <tr>
  3552. <td valign="top">sourcefiles</td>
  3553. <td valign="top">Comma separated list of source files</td>
  3554. <td align="center" valign="top">all</td>
  3555. <td align="center" valign="middle" rowspan="2">at least one of the two</td>
  3556. </tr>
  3557. <tr>
  3558. <td valign="top">packagenames</td>
  3559. <td valign="top">Comma separated list of package files (with terminating
  3560. wildcard)</td>
  3561. <td align="center" valign="top">all</td>
  3562. </tr>
  3563. <tr>
  3564. <td valign="top">packageList</td>
  3565. <td valign="top">The name of a file containing the packages to process</td>
  3566. <td align="center" valign="top">all</td>
  3567. <td align="center" valign="top">No</td>
  3568. </tr>
  3569. <tr>
  3570. <td valign="top">classpath</td>
  3571. <td valign="top">Specify where to find user class files</td>
  3572. <td align="center" valign="top">all</td>
  3573. <td align="center" valign="top">No</td>
  3574. </tr>
  3575. <tr>
  3576. <td valign="top">Bootclasspath</td>
  3577. <td valign="top">Override location of class files loaded by the bootstrap
  3578. class loader</td>
  3579. <td align="center" valign="top">1.2</td>
  3580. <td align="center" valign="top">No</td>
  3581. </tr>
  3582. <tr>
  3583. <td valign="top">classpathref</td>
  3584. <td valign="top">Specify where to find user class files by <a
  3585. href="#references">reference</a> to a PATH defined elsewhere.</td>
  3586. <td align="center" valign="top">all</td>
  3587. <td align="center" valign="top">No</td>
  3588. </tr>
  3589. <tr>
  3590. <td valign="top">bootclasspathref</td>
  3591. <td valign="top">Override location of class files loaded by the
  3592. bootstrap class loader by <a href="#references">reference</a> to a
  3593. PATH defined elsewhere.</td>
  3594. <td align="center" valign="top">1.2</td>
  3595. <td align="center" valign="top">No</td>
  3596. </tr>
  3597. <tr>
  3598. <td valign="top">Extdirs</td>
  3599. <td valign="top">Override location of installed extensions</td>
  3600. <td align="center" valign="top">1.2</td>
  3601. <td align="center" valign="top">No</td>
  3602. </tr>
  3603. <tr>
  3604. <td valign="top">Overview</td>
  3605. <td valign="top">Read overview documentation from HTML file</td>
  3606. <td align="center" valign="top">1.2</td>
  3607. <td align="center" valign="top">No</td>
  3608. </tr>
  3609. <tr>
  3610. <td valign="top">Public</td>
  3611. <td valign="top">Show only public classes and members</td>
  3612. <td align="center" valign="top">all</td>
  3613. <td align="center" valign="top">No</td>
  3614. </tr>
  3615. <tr>
  3616. <td valign="top">Protected</td>
  3617. <td valign="top">Show protected/public classes and members (default)</td>
  3618. <td align="center" valign="top">all</td>
  3619. <td align="center" valign="top">No</td>
  3620. </tr>
  3621. <tr>
  3622. <td valign="top">Package</td>
  3623. <td valign="top">Show package/protected/public classes and members</td>
  3624. <td align="center" valign="top">all</td>
  3625. <td align="center" valign="top">No</td>
  3626. </tr>
  3627. <tr>
  3628. <td valign="top">Private</td>
  3629. <td valign="top">Show all classes and members</td>
  3630. <td align="center" valign="top">all</td>
  3631. <td align="center" valign="top">No</td>
  3632. </tr>
  3633. <tr>
  3634. <td valign="top">Old</td>
  3635. <td valign="top">Generate output using JDK 1.1 emulating doclet</td>
  3636. <td align="center" valign="top">1.2</td>
  3637. <td align="center" valign="top">No</td>
  3638. </tr>
  3639. <tr>
  3640. <td valign="top">Verbose</td>
  3641. <td valign="top">Output messages about what Javadoc is doing</td>
  3642. <td align="center" valign="top">1.2</td>
  3643. <td align="center" valign="top">No</td>
  3644. </tr>
  3645. <tr>
  3646. <td valign="top">Locale</td>
  3647. <td valign="top">Locale to be used, e.g. en_US or en_US_WIN</td>
  3648. <td align="center" valign="top">1.2</td>
  3649. <td align="center" valign="top">No</td>
  3650. </tr>
  3651. <tr>
  3652. <td valign="top">Encoding</td>
  3653. <td valign="top">Source file encoding name</td>
  3654. <td align="center" valign="top">all</td>
  3655. <td align="center" valign="top">No</td>
  3656. </tr>
  3657. <tr>
  3658. <td valign="top">Version</td>
  3659. <td valign="top">Include @version paragraphs</td>
  3660. <td align="center" valign="top">all</td>
  3661. <td align="center" valign="top">No</td>
  3662. </tr>
  3663. <tr>
  3664. <td valign="top">Use</td>
  3665. <td valign="top">Create class and package usage pages</td>
  3666. <td align="center" valign="top">1.2</td>
  3667. <td align="center" valign="top">No</td>
  3668. </tr>
  3669. <tr>
  3670. <td valign="top">Author</td>
  3671. <td valign="top">Include @author paragraphs</td>
  3672. <td align="center" valign="top">all</td>
  3673. <td align="center" valign="top">No</td>
  3674. </tr>
  3675. <tr>
  3676. <td valign="top">Splitindex</td>
  3677. <td valign="top">Split index into one file per letter</td>
  3678. <td align="center" valign="top">1.2</td>
  3679. <td align="center" valign="top">No</td>
  3680. </tr>
  3681. <tr>
  3682. <td valign="top">Windowtitle</td>
  3683. <td valign="top">Browser window title for the documentation (text)</td>
  3684. <td align="center" valign="top">1.2</td>
  3685. <td align="center" valign="top">No</td>
  3686. </tr>
  3687. <tr>
  3688. <td valign="top">Doctitle</td>
  3689. <td valign="top">Include title for the package index(first) page (html-code)</td>
  3690. <td align="center" valign="top">1.2</td>
  3691. <td align="center" valign="top">No</td>
  3692. </tr>
  3693. <tr>
  3694. <td valign="top">Header</td>
  3695. <td valign="top">Include header text for each page (html-code)</td>
  3696. <td align="center" valign="top">1.2</td>
  3697. <td align="center" valign="top">No</td>
  3698. </tr>
  3699. <tr>
  3700. <td valign="top">Footer</td>
  3701. <td valign="top">Include footer text for each page (html-code)</td>
  3702. <td align="center" valign="top">1.2</td>
  3703. <td align="center" valign="top">No</td>
  3704. </tr>
  3705. <tr>
  3706. <td valign="top">bottom</td>
  3707. <td valign="top">Include bottom text for each page (html-code)</td>
  3708. <td align="center" valign="top">1.2</td>
  3709. <td align="center" valign="top">No</td>
  3710. </tr>
  3711. <tr>
  3712. <td valign="top">link</td>
  3713. <td valign="top">Create links to javadoc output at the given URL</td>
  3714. <td align="center" valign="top">1.2</td>
  3715. <td align="center" valign="top">No</td>
  3716. </tr>
  3717. <tr>
  3718. <td valign="top">linkoffline</td>
  3719. <td valign="top">Link to docs at &lt;url&gt; using package list at
  3720. &lt;url2&gt;</td>
  3721. <td align="center" valign="top">1.2</td>
  3722. <td align="center" valign="top">No</td>
  3723. </tr>
  3724. <tr>
  3725. <td valign="top">group</td>
  3726. <td valign="top">Group specified packages together in overview page</td>
  3727. <td align="center" valign="top">1.2</td>
  3728. <td align="center" valign="top">No</td>
  3729. </tr>
  3730. <tr>
  3731. <td valign="top">nodeprecated</td>
  3732. <td valign="top">Do not include @deprecated information</td>
  3733. <td align="center" valign="top">all</td>
  3734. <td align="center" valign="top">No</td>
  3735. </tr>
  3736. <tr>
  3737. <td valign="top">nodeprecatedlist</td>
  3738. <td valign="top">Do not generate deprecated list</td>
  3739. <td align="center" valign="top">1.2</td>
  3740. <td align="center" valign="top">No</td>
  3741. </tr>
  3742. <tr>
  3743. <td valign="top">notree</td>
  3744. <td valign="top">Do not generate class hierarchy</td>
  3745. <td align="center" valign="top">all</td>
  3746. <td align="center" valign="top">No</td>
  3747. </tr>
  3748. <tr>
  3749. <td valign="top">noindex</td>
  3750. <td valign="top">Do not generate index</td>
  3751. <td align="center" valign="top">all</td>
  3752. <td align="center" valign="top">No</td>
  3753. </tr>
  3754. <tr>
  3755. <td valign="top">nohelp</td>
  3756. <td valign="top">Do not generate help link</td>
  3757. <td align="center" valign="top">1.2</td>
  3758. <td align="center" valign="top">No</td>
  3759. </tr>
  3760. <tr>
  3761. <td valign="top">nonavbar</td>
  3762. <td valign="top">Do not generate navigation bar</td>
  3763. <td align="center" valign="top">1.2</td>
  3764. <td align="center" valign="top">No</td>
  3765. </tr>
  3766. <tr>
  3767. <td valign="top">serialwarn</td>
  3768. <td valign="top">FUTURE: Generate warning about @serial tag</td>
  3769. <td align="center" valign="top">1.2</td>
  3770. <td align="center" valign="top">No</td>
  3771. </tr>
  3772. <tr>
  3773. <td valign="top">helpfile</td>
  3774. <td valign="top">FUTURE: Specifies the HTML help file to use</td>
  3775. <td align="center" valign="top">1.2</td>
  3776. <td align="center" valign="top">No</td>
  3777. </tr>
  3778. <tr>
  3779. <td valign="top">stylesheetfile</td>
  3780. <td valign="top">Specifies the CSS stylesheet to use</td>
  3781. <td align="center" valign="top">1.2</td>
  3782. <td align="center" valign="top">No</td>
  3783. </tr>
  3784. <tr>
  3785. <td valign="top">charset</td>
  3786. <td valign="top">FUTURE: Charset for cross-platform viewing of generated
  3787. documentation</td>
  3788. <td align="center" valign="top">1.2</td>
  3789. <td align="center" valign="top">No</td>
  3790. </tr>
  3791. <tr>
  3792. <td valign="top">docencoding</td>
  3793. <td valign="top">Output file encoding name</td>
  3794. <td align="center" valign="top">1.1</td>
  3795. <td align="center" valign="top">No</td>
  3796. </tr>
  3797. <tr>
  3798. <td valign="top">doclet</td>
  3799. <td valign="top">Specifies the class file that starts the doclet used in generating the documentation.</td>
  3800. <td align="center" valign="top">1.2</td>
  3801. <td align="center" valign="top">No</td>
  3802. </tr>
  3803. <tr>
  3804. <td valign="top">docletpath</td>
  3805. <td valign="top">Specifies the path to the doclet class file that is specified with the -doclet option.</td>
  3806. <td align="center" valign="top">1.2</td>
  3807. <td align="center" valign="top">No</td>
  3808. </tr>
  3809. <tr>
  3810. <td valign="top">docletpathref</td>
  3811. <td valign="top">Specifies the path to the doclet class file that
  3812. is specified with the -doclet option by <a
  3813. href="#references">reference</a> to a PATH defined elsewhere.</td>
  3814. <td align="center" valign="top">1.2</td>
  3815. <td align="center" valign="top">No</td>
  3816. </tr>
  3817. <tr>
  3818. <td valign="top">additionalparam</td>
  3819. <td valign="top">Lets you add additional parameters to the javadoc command line. Useful for doclets</td>
  3820. <td align="center" valign="top">1.2</td>
  3821. <td align="center" valign="top">No</td>
  3822. </tr>
  3823. <tr>
  3824. <td valign="top">failonerror</td>
  3825. <td valign="top">Stop the buildprocess if the command exits with a
  3826. returncode other than 0.</td>
  3827. <td align="center" valign="top">all</td>
  3828. <td align="center" valign="top">No</td>
  3829. </tr>
  3830. </table>
  3831. <h3>Parameters specified as nested elements</h3>
  3832. <h4>link</h4>
  3833. <p>Create link to javadoc output at the given URL. This performs the
  3834. same role as the link and linkoffline attributes. You can use either
  3835. syntax (or both at once), but with the nested elements you can easily
  3836. specify multiple occurrences of the arguments.</p>
  3837. <h4>Parameters</h4>
  3838. <table width="60%" border="1" cellpadding="2" cellspacing="0">
  3839. <tr>
  3840. <td valign="top"><b>Attribute</b></td>
  3841. <td valign="top"><b>Description</b></td>
  3842. <td align="center" valign="top"><b>Required</b></td>
  3843. </tr>
  3844. <tr>
  3845. <td valign="top">href</td>
  3846. <td valign="top">The URL for the external documentation you wish to link to</td>
  3847. <td align="center" valign="top">Yes</td>
  3848. </tr>
  3849. <tr>
  3850. <td valign="top">offline</td>
  3851. <td valign="top">True if this link is not available online at the time of
  3852. generating the documentation</td>
  3853. <td align="center" valign="top">No</td>
  3854. </tr>
  3855. <tr>
  3856. <td valign="top">packagelistLoc</td>
  3857. <td valign="top">The location to the directory containing the package-list file for
  3858. the external documentation</td>
  3859. <td align="center" valign="top">Only if the offline attribute is true</td>
  3860. </tr>
  3861. </table>
  3862. <h4>groups</h4>
  3863. <p>Separates packages on the overview page into whatever groups you
  3864. specify, one group per table. This performs the same role as the group
  3865. attribute. You can use either syntax (or both at once), but with the
  3866. nested elements you can easily specify multiple occurrences of the
  3867. arguments.</p>
  3868. <table width="60%" border="1" cellpadding="2" cellspacing="0">
  3869. <tr>
  3870. <td valign="top"><b>Attribute</b></td>
  3871. <td valign="top"><b>Description</b></td>
  3872. <td align="center" valign="top"><b>Required</b></td>
  3873. </tr>
  3874. <tr>
  3875. <td valign="top">title</td>
  3876. <td valign="top">Title of the group</td>
  3877. <td align="center" valign="top">Yes</td>
  3878. </tr>
  3879. <tr>
  3880. <td valign="top">packages</td>
  3881. <td valign="top">List of packages to include in that group</td>
  3882. <td align="center" valign="top">Yes</td>
  3883. </tr>
  3884. </table>
  3885. <h4>doclet</h4>
  3886. <p>The doclet nested element is used to specify the doclet that javadoc will
  3887. use to process the input source files. A number of the standard javadoc arguments
  3888. are actually arguments of the standard doclet. If these are specified in the javadoc
  3889. task's attributes, they will be passed to the doclet specified in the
  3890. <code>&lt;doclet&gt;</code> nested element. Such attributes should only be specified,
  3891. therefore, if they can be interpreted by the doclet in use.
  3892. <p>If the doclet requires additional parameters, these can be specified with
  3893. <code>&lt;param&gt;</code> elements within the <code>&lt;doclet&gt;</code>
  3894. element. These paramaters are restricted to simple strings. An example usage
  3895. of the doclet element is shown below:
  3896. <pre> &lt;javadoc ...&gt;
  3897. &lt;doclet name="theDoclet"
  3898. path="path/to/theDoclet"&gt;
  3899. &lt;param name="-foo" value="foovalue"/&gt;
  3900. &lt;param name="-bar" value="barvalue"/&gt;
  3901. &lt;/doclet&gt;
  3902. &lt;/javadoc&gt;
  3903. </pre>
  3904. <h4>sourcepath, classpath and bootclasspath</h4>
  3905. <p><code>Javadoc</code>'s <i>sourcepath</i>, <i>classpath</i> and
  3906. <i>bootclasspath</i> attributes are <a href="#path">PATH like
  3907. structure</a> and can also be set via nested <i>sourcepath</i>,
  3908. <i>classpath</i> and <i>bootclasspath</i> elements
  3909. respectively.</p>
  3910. <h3>Example</h3>
  3911. <pre> &lt;javadoc packagenames=&quot;com.dummy.test.*&quot;
  3912. sourcepath=&quot;src&quot;
  3913. destdir=&quot;docs/api&quot;
  3914. author=&quot;true&quot;
  3915. version=&quot;true&quot;
  3916. use=&quot;true&quot;
  3917. windowtitle=&quot;Test API&quot;
  3918. doctitle=&quot;&lt;h1&gt;Test&lt;/h1&gt;&quot;
  3919. bottom=&quot;&lt;i&gt;Copyright &amp;#169; 2000 Dummy Corp. All Rights Reserved.&lt;/i&gt;&quot;&gt;
  3920. &lt;group title=&quot;Group 1 Packages&quot; packages=&quot;com.dummy.test.a*&quot;/&gt;
  3921. &lt;group title=&quot;Group 2 Packages&quot; packages=&quot;com.dummy.test.b*&quot;/&gt;
  3922. &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;
  3923. &lt;link href=&quot;http://developer.java.sun.com/developer/products/xml/docs/api/&quot;/&gt;
  3924. &lt/javadoc&gt;</pre>
  3925. <hr>
  3926. <h2><a name="mail">Mail</a></h2>
  3927. <h3>Description</h3>
  3928. <p>A task to send SMTP email.</p>
  3929. <h3>Parameters</h3>
  3930. <table border="1" cellpadding="2" cellspacing="0">
  3931. <tr>
  3932. <td valign="top"><b>Attribute</b></td>
  3933. <td valign="top"><b>Description</b></td>
  3934. <td align="center" valign="top"><b>Required</b></td>
  3935. </tr>
  3936. <tr>
  3937. <td valign="top">from</td>
  3938. <td valign="top">Email address of sender.</td>
  3939. <td align="center" valign="top">Yes</td>
  3940. </tr>
  3941. <tr>
  3942. <td valign="top">tolist</td>
  3943. <td valign="top">Comma-separated list of recipients.</td>
  3944. <td align="center" valign="top">Yes</td>
  3945. </tr>
  3946. <tr>
  3947. <td valign="top">message</td>
  3948. <td valign="top">Message to send in the body of the email.</td>
  3949. <td align="center" valign="middle" rowspan="2">Yes</td>
  3950. </tr>
  3951. <tr>
  3952. <td valign="top">files</td>
  3953. <td valign="top">Filename(s) of text to send in the body of the email.
  3954. Multiple files are comma-separated.</td>
  3955. </tr>
  3956. <tr>
  3957. <td valign="top">mailhost</td>
  3958. <td valign="top">Host name of the mail server.</td>
  3959. <td align="center" valign="top">No, default to &quot;localhost&quot;</td>
  3960. </tr>
  3961. <tr>
  3962. <td valign="top">subject</td>
  3963. <td valign="top">Email subject line.</td>
  3964. <td align="center" valign="top">No</td>
  3965. </tr>
  3966. </table>
  3967. <h3>Examples</h3>
  3968. <pre>
  3969. &lt;mail from=&quot;me&quot; tolist=&quot;you&quot; subject=&quot;Results of nightly build&quot;
  3970. files=&quot;build.log&quot;/&gt;</pre>
  3971. <p>Sends an eMail from <i>me</i> to <i>you</i> with a subject of
  3972. <i>Results of nightly build</i> and includes the contents of <i>build.log</i>
  3973. in the body of the message.</p>
  3974. <hr>
  3975. <h2><a name="mkdir">Mkdir</a></h2>
  3976. <h3>Description</h3>
  3977. <p>Creates a directory. Also non-existent parent directories are created, when
  3978. necessary.</p>
  3979. <h3>Parameters</h3>
  3980. <table border="1" cellpadding="2" cellspacing="0">
  3981. <tr>
  3982. <td valign="top"><b>Attribute</b></td>
  3983. <td valign="top"><b>Description</b></td>
  3984. <td align="center" valign="top"><b>Required</b></td>
  3985. </tr>
  3986. <tr>
  3987. <td valign="top">dir</td>
  3988. <td valign="top">the directory to create.</td>
  3989. <td align="center" valign="top">Yes</td>
  3990. </tr>
  3991. </table>
  3992. <h3>Examples</h3>
  3993. <pre>&lt;mkdir dir=&quot;${dist}&quot;/&gt;</pre>
  3994. <p>creates a directory <code>${dist}</code>.</p>
  3995. <pre>&lt;mkdir dir=&quot;${dist}/lib&quot;/&gt;</pre>
  3996. <p>creates a directory <code>${dist}/lib</code>.</p>
  3997. <hr>
  3998. <h2><a name="move">Move</a></h2>
  3999. <h3>Description</h3>
  4000. <p>Moves a file to a new file or directory, or sets of files to
  4001. a new directory. By default, the
  4002. destination file is overwritten if it already exists. When <var>overwrite</var> is
  4003. turned off, then files are only moved if the source file is newer than
  4004. the destination file, or when the destination file does not exist.</p>
  4005. <p><a href="#fileset">FileSet</a>s are used to select sets of files
  4006. to move to the <var>todir</var> directory.</p>
  4007. <h3>Parameters</h3>
  4008. <table border="1" cellpadding="2" cellspacing="0">
  4009. <tr>
  4010. <td valign="top"><b>Attribute</b></td>
  4011. <td valign="top"><b>Description</b></td>
  4012. <td align="center" valign="top"><b>Required</b></td>
  4013. </tr>
  4014. <tr>
  4015. <td valign="top">file</td>
  4016. <td valign="top">the file to move</td>
  4017. <td valign="top" align="center">One of <var>file</var> or
  4018. at least one nested fileset element</td>
  4019. </tr>
  4020. <tr>
  4021. <td valign="top">tofile</td>
  4022. <td valign="top">the file to move to</td>
  4023. <td valign="top" align="center" rowspan="2">With the <var>file</var> attribute,
  4024. either <var>tofile</var> or <var>todir</var> can be used. With a nested fileset,
  4025. only <var>todir</var> is allowed.</td>
  4026. </tr>
  4027. <tr>
  4028. <td valign="top">todir</td>
  4029. <td valign="top">the directory to move to</td>
  4030. </tr>
  4031. <tr>
  4032. <td valign="top">overwrite</td>
  4033. <td valign="top">overwrite existing files even if the destination
  4034. files are newer (default is &quot;true&quot;)</td>
  4035. <td valign="top" align="center">No</td>
  4036. </tr>
  4037. <tr>
  4038. <td valign="top">filtering</td>
  4039. <td valign="top">indicates whether token filtering should take place during
  4040. the move. See the <a href="#filter">filter</a> task for a description of
  4041. how filters work.</td>
  4042. <td valign="top" align="center">No</td>
  4043. </tr>
  4044. <tr>
  4045. <td valign="top">flatten</td>
  4046. <td valign="top">ignore directory structure of source directory,
  4047. copy all files into a single directory, specified by the <var>todir</var>
  4048. attribute (default is &quot;false&quot;).Note that you can achieve the
  4049. same effect by using a <a href="#flatten-mapper">flatten mapper</a></td>
  4050. <td valign="top" align="center">No</td>
  4051. </tr>
  4052. <tr>
  4053. <td valign="top">includeEmptyDirs</td>
  4054. <td valign="top">Copy empty directories included with the nested FileSet(s).
  4055. Defaults to &quot;yes&quot;.</td>
  4056. <td valign="top" align="center">No</td>
  4057. </tr>
  4058. </table>
  4059. <h3>Parameters specified as nested elements</h3>
  4060. <h4>mapper</h4>
  4061. <p>You can define file name transformations by using a nested <a
  4062. href="#mapper">mapper</a> element. The default mapper used by
  4063. <code>&lt;copy&gt;</code> is the <a
  4064. href="#identity-mapper">identity</a>.</p>
  4065. <h3>Examples</h3>
  4066. <p><b>Move a single file (rename a file)</b></p>
  4067. <pre>
  4068. &lt;move file=&quot;file.orig&quot; tofile=&quot;file.moved&quot;/&gt;
  4069. </pre>
  4070. <p><b>Move a single file to a directory</b></p>
  4071. <pre>
  4072. &lt;move file=&quot;file.orig&quot; todir=&quot;dir/to/move/to&quot;/&gt;
  4073. </pre>
  4074. <p><b>Move a directory to a new directory</b></p>
  4075. <pre>
  4076. &lt;move todir=&quot;new/dir/to/move/to&quot;&gt;
  4077. &lt;fileset dir=&quot;src/dir&quot;/&gt;
  4078. &lt;/move&gt;
  4079. </pre>
  4080. <p><b>Move a set of files to a new directory</b></p>
  4081. <pre>
  4082. &lt;move todir=&quot;some/new/dir&quot; &gt;
  4083. &lt;fileset dir=&quot;my/src/dir&quot; &gt;
  4084. &lt;include name=&quot;**/*.jar&quot;/&gt;
  4085. &lt;exclude name=&quot;**/ant.jar&quot;/&gt;
  4086. &lt;/fileset&gt;
  4087. &lt;/move&gt;
  4088. </pre>
  4089. <p><b>Append <code>&quot;.bak&quot;</code> to the names of all files
  4090. in a directory.</b></p>
  4091. <pre>
  4092. &lt;move todir=&quot;my/src/dir&quot; &gt;
  4093. &lt;fileset dir=&quot;my/src/dir&quot; &gt;
  4094. &lt;exclude name=&quot;**/*.bak&quot;/&gt;
  4095. &lt;/fileset&gt;
  4096. &lt;mapper type=&quot;glob&quot; from=&quot;*&quot; to=&quot;*.bak&quot;/&gt;
  4097. &lt;/move&gt;
  4098. </pre>
  4099. <hr>
  4100. <h2><a name="patch">Patch</a></h2>
  4101. <h3>Description</h3>
  4102. <p>Applies a diff file to originals.</p>
  4103. <h3>Parameters</h3>
  4104. <table border="1" cellpadding="2" cellspacing="0">
  4105. <tr>
  4106. <td valign="top"><b>Attribute</b></td>
  4107. <td valign="top"><b>Description</b></td>
  4108. <td align="center" valign="top"><b>Required</b></td>
  4109. </tr>
  4110. <tr>
  4111. <td valign="top">patchfile</td>
  4112. <td valign="top">the file that includes the diff output</td>
  4113. <td align="center" valign="top">Yes</td>
  4114. </tr>
  4115. <tr>
  4116. <td valign="top">originalfile</td>
  4117. <td valign="top">the file to patch</td>
  4118. <td align="center" valign="top">No, tries to guess it from the diff
  4119. file</td>
  4120. </tr>
  4121. <tr>
  4122. <td valign="top">backups</td>
  4123. <td valign="top">Keep backups of the unpatched files</td>
  4124. <td align="center" valign="top">No</td>
  4125. </tr>
  4126. <tr>
  4127. <td valign="top">quiet</td>
  4128. <td valign="top">Work silently unless an error occurs</td>
  4129. <td align="center" valign="top">No</td>
  4130. </tr>
  4131. <tr>
  4132. <td valign="top">reverse</td>
  4133. <td valign="top">Assume patch was created with old and new files
  4134. swapped.</td>
  4135. <td align="center" valign="top">No</td>
  4136. </tr>
  4137. <tr>
  4138. <td valign="top">ignorewhitespace</td>
  4139. <td valign="top">Ignore whitespace differences.</td>
  4140. <td align="center" valign="top">No</td>
  4141. </tr>
  4142. <tr>
  4143. <td valign="top">strip</td>
  4144. <td valign="top">Strip the smallest prefix containing <i>num</i> leading
  4145. slashes from filenames.</td>
  4146. <td align="center" valign="top">No</td>
  4147. </tr>
  4148. </table>
  4149. <h3>Examples</h3>
  4150. <pre> &lt;patch patchfile=&quot;module.1.0-1.1.patch&quot;/&gt;</pre>
  4151. <p>applies the diff included in <i>module.1.0-1.1.patch</i> to the
  4152. files in base directory guessing the filename(s) from the diff output.
  4153. <pre> &lt;patch patchfile=&quot;module.1.0-1.1.patch&quot; strip=&quot;1&quot;/&gt;</pre>
  4154. <p>like above but one leading directory part will be removed. i.e. if
  4155. the diff output looked like
  4156. <pre>
  4157. --- a/mod1.0/A Mon Jun 5 17:28:41 2000
  4158. +++ a/mod1.1/A Mon Jun 5 17:28:49 2000
  4159. </pre>
  4160. the leading <i>a/</i> will be stripped.
  4161. <hr>
  4162. <h2><a name="property">Property</a></h2>
  4163. <h3>Description</h3>
  4164. <p>Sets a property (by name and value), or set of properties (from file or
  4165. resource) in the project.</p>
  4166. <p>When a property was set by the user, or was a property in a parent project
  4167. (that started this project with the <a href="#ant">ant task</a>), then this
  4168. property cannot be set, and will be ignored. This means that properties set
  4169. outside the current project always override the properties of the current
  4170. project.</p>
  4171. <p>There are five ways to set properties:</p>
  4172. <ul>
  4173. <li>By supplying both the <i>name</i> and <i>value</i> attribute.</li>
  4174. <li>By supplying both the <i>name</i> and <i>refid</i> attribute.</li>
  4175. <li>By setting the <i>file</i> attribute with the filename of the property
  4176. file to load. This property file has the format as defined by the file used
  4177. in the class java.util.Properties.</li>
  4178. <li>By setting the <i>resource</i> attribute with the resource name of the
  4179. property file to load. This property file has the format as defined by the
  4180. file used in the class java.util.Properties.</li>
  4181. <li>By setting the <i>environment</i> attribute with a prefix to use.
  4182. Properties will be defined for every environment variable by
  4183. prefixing the suplied name and a period to the name of the variable.</li>
  4184. </ul>
  4185. <p>Although combinations of the three ways are possible, only one should be used
  4186. at a time. Problems might occur with the order in which properties are set, for
  4187. instance.</p>
  4188. <p>The value part of the properties being set, might contain references to other
  4189. properties. These references are resolved at the time these properties are set.
  4190. This also holds for properties loaded from a property file.</p>
  4191. <h3>Parameters</h3>
  4192. <table border="1" cellpadding="2" cellspacing="0">
  4193. <tr>
  4194. <td valign="top"><b>Attribute</b></td>
  4195. <td valign="top"><b>Description</b></td>
  4196. <td align="center" valign="top"><b>Required</b></td>
  4197. </tr>
  4198. <tr>
  4199. <td valign="top">name</td>
  4200. <td valign="top">the name of the property to set.</td>
  4201. <td valign="top" align="center">Yes</td>
  4202. </tr>
  4203. <tr>
  4204. <td valign="top">value</td>
  4205. <td valign="top">the value of the property.</td>
  4206. <td valign="middle" align="center" rowspan="5">Yes</td>
  4207. </tr>
  4208. <tr>
  4209. <td valign="top">refid</td>
  4210. <td valign="top"><a href="#references">Reference</a> to an object
  4211. defined elsewhere. Only yields reasonable results for references
  4212. to <a href="#path">PATH like structures</a> or properties.</td>
  4213. </tr>
  4214. <tr>
  4215. <td valign="top">resource</td>
  4216. <td valign="top">the resource name of the property file.</td>
  4217. </tr>
  4218. <tr>
  4219. <td valign="top">file</td>
  4220. <td valign="top">the filename of the property file .</td>
  4221. </tr>
  4222. <tr>
  4223. <td valign="top">location</td>
  4224. <td valign="top">Sets the property to the absolute filename of the
  4225. given file. If the value of this attribute is an absolute path, it
  4226. is left unchanged (with / and \ characters converted to the
  4227. current platforms conventions). Otherwise it is taken as a path
  4228. relative to the project's basedir and expanded.</td>
  4229. </tr>
  4230. <tr>
  4231. <td valign="top">classpath</td>
  4232. <td valign="top">the classpath to use when looking up a resource.</td>
  4233. <td align="center" valign="top">No</td>
  4234. </tr>
  4235. <tr>
  4236. <td valign="top">classpathref</td>
  4237. <td valign="top">the classpath to use when looking up a resource,
  4238. given as <a href="#references">reference</a> to a PATH defined
  4239. elsewhere..</td>
  4240. <td align="center" valign="top">No</td>
  4241. </tr>
  4242. </table>
  4243. <h3>Parameters specified as nested elements</h3>
  4244. <h4>classpath</h4>
  4245. <p><code>Property</code>'s <i>classpath</i> attribute is a <a
  4246. href="#path">PATH like structure</a> and can also be set via a nested
  4247. <i>classpath</i> element.</p>
  4248. <h3>Examples</h3>
  4249. <pre> &lt;property name=&quot;foo.dist&quot; value=&quot;dist&quot;/&gt;</pre>
  4250. <p>sets the property <code>foo.dist</code> to the value &quot;dist&quot;.</p>
  4251. <pre> &lt;property file=&quot;foo.properties&quot;/&gt;</pre>
  4252. <p>reads a set of properties from a file called &quot;foo.properties&quot;.</p>
  4253. <pre> &lt;property resource=&quot;foo.properties&quot;/&gt;</pre>
  4254. <p>reads a set of properties from a resource called &quot;foo.properties&quot;.</p>
  4255. <p>Note that you can reference a global properties file for all of your Ant
  4256. builds using the following:
  4257. <pre> &lt;property file=&quot;${user.home}/.ant-global.properties&quot;/&gt;</pre>
  4258. <p>since the &quot;user.home&quot; property is defined by the Java virtual machine
  4259. to be your home directory. This technique is more appropriate for Unix than
  4260. Windows since the notion of a home directory doesn't exist on Windows. On the
  4261. JVM that I tested, the home directory on Windows is &quot;C:\&quot;. Different JVM
  4262. implementations may use other values for the home directory on Windows.</p>
  4263. <hr>
  4264. <h2><a name="rename">Rename</a></h2>
  4265. <h3><i>Deprecated</i></h3>
  4266. <p><i>This task has been deprecated. Use the Move task instead.</i></p>
  4267. <h3>Description</h3>
  4268. <p>Renames a given file.</p>
  4269. <h3>Parameters</h3>
  4270. <table border="1" cellpadding="2" cellspacing="0">
  4271. <tr>
  4272. <td valign="top"><b>Attribute</b></td>
  4273. <td valign="top"><b>Description</b></td>
  4274. <td align="center" valign="top"><b>Required</b></td>
  4275. </tr>
  4276. <tr>
  4277. <td valign="top">src</td>
  4278. <td valign="top">file to rename.</td>
  4279. <td valign="top" align="center">Yes</td>
  4280. </tr>
  4281. <tr>
  4282. <td valign="top">dest</td>
  4283. <td valign="top">new name of the file.</td>
  4284. <td valign="top" align="center">Yes</td>
  4285. </tr>
  4286. <tr>
  4287. <td valign="top">replace</td>
  4288. <td valign="top">Enable replacing of existing file (default: on).</td>
  4289. <td valign="top" align="center">No</td>
  4290. </tr>
  4291. </table>
  4292. <h3>Examples</h3>
  4293. <pre> &lt;rename src=&quot;foo.jar&quot; dest=&quot;${name}-${version}.jar&quot;/&gt;</pre>
  4294. <p>Renames the file <code>foo.jar</code> to <code>${name}-${version}.jar</code> (assuming <code>name</code>
  4295. and <code>version</code> being predefined properties). If a file named <code>${name}-${version}.jar</code>
  4296. already exists, it will be removed prior to renaming <code>foo.jar</code>.</p>
  4297. <hr>
  4298. <h2><a name="replace">Replace</a></h2>
  4299. <h3>Description</h3>
  4300. <p>Replace is a directory based task for replacing the occurrence of a given string with another string
  4301. in selected file.</p>
  4302. <p>If you want to replace a text that crosses line boundaries, you
  4303. must use a nested <code>&lt;replacetoken&gt;</code> element.</p>
  4304. <h3>Parameters</h3>
  4305. <table border="1" cellpadding="2" cellspacing="0">
  4306. <tr>
  4307. <td valign="top"><b>Attribute</b></td>
  4308. <td valign="top"><b>Description</b></td>
  4309. <td align="center" valign="top"><b>Required</b></td>
  4310. </tr>
  4311. <tr>
  4312. <td valign="top">file</td>
  4313. <td valign="top">file for which the token should be replaced.</td>
  4314. <td align="center" rowspan="2">Exactly one of the two.</td>
  4315. </tr>
  4316. <tr>
  4317. <td valign="top">dir</td>
  4318. <td valign="top">The base directory to use when replacing a token in
  4319. multiple files.</td>
  4320. </tr>
  4321. <tr>
  4322. <td valign="top">token</td>
  4323. <td valign="top">the token which must be replaced.</td>
  4324. <td valign="top" align="center">Yes, unless a nested <code>replacetoken</code>
  4325. element is used.</td>
  4326. </tr>
  4327. <tr>
  4328. <td valign="top">value</td>
  4329. <td valign="top">the new value for the token. When omitted, an empty string
  4330. (&quot;&quot;) is used.</td>
  4331. <td valign="top" align="center">No</td>
  4332. </tr>
  4333. <tr>
  4334. <td valign="top">propertyFile</td>
  4335. <td valign="top">valid property file from which properties specified using nested <code>&lt;replacefilter&gt;</code> elements are drawn.</td>
  4336. <td valign="top" align="center">Yes only if <i>property</i> attribute of <code>&lt;replacefilter&gt;</code> is used.</td>
  4337. </tr>
  4338. <tr>
  4339. <td valign="top">includes</td>
  4340. <td valign="top">comma separated list of patterns of files that must be
  4341. included. All files are included when omitted.</td>
  4342. <td valign="top" align="center">No</td>
  4343. </tr>
  4344. <tr>
  4345. <td valign="top">includesfile</td>
  4346. <td valign="top">the name of a file. Each line of this file is
  4347. taken to be an include pattern</td>
  4348. <td valign="top" align="center">No</td>
  4349. </tr>
  4350. <tr>
  4351. <td valign="top">excludes</td>
  4352. <td valign="top">comma separated list of patterns of files that must be
  4353. excluded. No files (except default excludes) are excluded when omitted.</td>
  4354. <td valign="top" align="center">No</td>
  4355. </tr>
  4356. <tr>
  4357. <td valign="top">excludesfile</td>
  4358. <td valign="top">the name of a file. Each line of this file is
  4359. taken to be an exclude pattern</td>
  4360. <td valign="top" align="center">No</td>
  4361. </tr>
  4362. <tr>
  4363. <td valign="top">defaultexcludes</td>
  4364. <td valign="top">indicates whether default excludes should be used or not
  4365. (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when omitted.</td>
  4366. <td valign="top" align="center">No</td>
  4367. </tr>
  4368. </table>
  4369. <h3>Examples</h3>
  4370. <pre> &lt;replace file=&quot;${src}/index.html&quot; token=&quot;@@@&quot; value=&quot;wombat&quot;/&gt;</pre>
  4371. <p>replaces occurrences of the string &quot;@@@&quot; with the string
  4372. &quot;wombat&quot;, in the file <code>${src}/index.html</code>.</p>
  4373. <h3>Parameters specified as nested elements</h3>
  4374. <p>This task forms an implicit <a href="#fileset">FileSet</a> and
  4375. supports all attributes of <code>&lt;fileset&gt;</code> as well as the
  4376. nested <code>&lt;include&gt;</code>, <code>&lt;exclude&gt;</code> and
  4377. <code>&lt;patternset&gt;</code> elements.</p>
  4378. <p>If either the text you want to replace or the replacement text
  4379. cross line boundaries, you can use nested elements to specify
  4380. them.</p>
  4381. <h3>Examples</h3>
  4382. <blockquote><pre>
  4383. &lt;replace dir=&quot;${src}&quot; value=&quot;wombat&quot;&gt;
  4384. &lt;include name=&quot;**/*.html&quot;/&gt;
  4385. &lt;replacetoken&gt;&lt;![CDATA[multi line
  4386. token]]>&lt;/replacetoken&gt;
  4387. &lt;/replace&gt;
  4388. </pre></blockquote>
  4389. <p>replaces occurrences of the string &quot;multi
  4390. line<i>\n</i>token&quot; with the string &quot;wombat&quot;, in all
  4391. HTML files in the directory <code>${src}</code>.Where <i>\n</i> is
  4392. the platform specific line separator.</p>
  4393. <blockquote><pre>
  4394. &lt;replace file=&quot;${src}/index.html&quot;&gt;
  4395. &lt;replacetoken&gt;&lt;![CDATA[two line
  4396. token]]>&lt;/replacetoken&gt;
  4397. &lt;replacevalue&gt;&lt;![CDATA[two line
  4398. token]]>&lt;/replacevalue&gt;
  4399. &lt;/replace&gt;
  4400. </pre></blockquote>
  4401. <h4>replacefilter</h4>
  4402. <p>In addition to allowing for multiple replacements, optional nested <code>&lt;replacefilter&gt;</code> elements allow replacement values to be extracted from a property file. The name of this file is specified using the <code>&lt;replace&gt;</code> attribute <i>propertyFile</i>.
  4403. </p>
  4404. <table border="1" cellpadding="2" cellspacing="0">
  4405. <tr>
  4406. <td valign="top"><b>Attribute</b></td>
  4407. <td valign="top"><b>Description</b></td>
  4408. <td align="center" valign="top"><b>Required</b></td>
  4409. </tr>
  4410. <tr>
  4411. <td valign="top">token</td>
  4412. <td valign="top">The string to search for.</td>
  4413. <td align="center" valign="top">Yes</td>
  4414. </tr>
  4415. <tr>
  4416. <td valign="top">value</td>
  4417. <td valign="top">The replacement string.</td>
  4418. <td align="center" rowspan="2">Either may be specified, but not both. Both can be omitted, if desired.</td>
  4419. </tr>
  4420. <tr>
  4421. <td valign="top">property</td>
  4422. <td valign="top">Name of the property whose value is to serve as the replacement value.</td>
  4423. </tr>
  4424. </table>
  4425. <p>If neither <i>value</i> nor <i>property</i> is used, the value provided using the <code>&lt;replace&gt;</code> attribute <i>value</i> and/or the <code>&lt;replacevalue&gt;</code> element is used. If no value was specified using either of these options, the token is replaced with an empty string.
  4426. </p>
  4427. <h3>Examples</h3>
  4428. <blockquote><pre>
  4429. &lt;replace
  4430. file=&quot;configure.sh&quot;
  4431. value=&quot;defaultvalue&quot;
  4432. propertyFile=&quot;source/name.properties&quot; &gt;
  4433. &lt;replacefilter
  4434. token=&quot;@token1@&quot; /&gt;
  4435. &lt;replacefilter
  4436. token=&quot;@token2@&quot;
  4437. value=&quot;value2&quot;/&gt;
  4438. &lt;replacefilter
  4439. token=&quot;@token3@&quot;
  4440. property=&quot;property.key&quot;/&gt;
  4441. &lt;/replace&gt;
  4442. </pre></blockquote>
  4443. <p>In file <code>configure.sh</code>, replace all instances of &quot;@token1@&quot; with &quot;defaultvalue&quot;, all instances of &quot;@token2@&quot; with &quot;value2&quot;, and all instances of &quot;@token3@&quot; with the value of the property &quot;property.key&quot;, as it appears in property file <code>src/name.properties</code>.</p>
  4444. <p><b>Note:</b> It is possible to use either the <i>token</i>/<code>&lt;replacetoken&gt;</code> and <i>value</i>/<code>&lt;replacevalue&gt;</code> attributes/elements, the nested replacefilter elements, or both in the same operation.
  4445. </p>
  4446. <hr>
  4447. <h2><a name="rmic">Rmic</a></h2>
  4448. <h3>Description</h3>
  4449. <p>Runs the rmic compiler for a certain class.</p>
  4450. <p>Rmic can be run on a single class (as specified with the classname
  4451. attribute) or a number of classes at once (all classes below base that
  4452. are neither _Stub nor _Skel classes).</p>
  4453. <p>It is possible to refine the set of files that are being rmiced. This can be
  4454. done with the <i>includes</i>, <i>includesfile</i>, <i>excludes</i>, <i>excludesfile</i> and <i>defaultexcludes</i>
  4455. attributes. With the <i>includes</i> or <i>includesfile</i> attribute you specify the files you want to
  4456. have included by using patterns. The <i>exclude</i> or <i>excludesfile</i> attribute is used to specify
  4457. the files you want to have excluded. This is also done with patterns. And
  4458. finally with the <i>defaultexcludes</i> attribute, you can specify whether you
  4459. want to use default exclusions or not. See the section on <a
  4460. href="#directorybasedtasks">directory based tasks</a>, on how the
  4461. inclusion/exclusion of files works, and how to write patterns.</p>
  4462. <p>This task forms an implicit <a href="#fileset">FileSet</a> and
  4463. supports all attributes of <code>&lt;fileset&gt;</code>
  4464. (<code>dir</code> becomes <code>base</code>) as well as the nested
  4465. <code>&lt;include&gt;</code>, <code>&lt;exclude&gt;</code> and
  4466. <code>&lt;patternset&gt;</code> elements.</p>
  4467. <h3>Parameters</h3>
  4468. <table border="1" cellpadding="2" cellspacing="0">
  4469. <tr>
  4470. <td valign="top"><b>Attribute</b></td>
  4471. <td valign="top"><b>Description</b></td>
  4472. <td align="center" valign="top"><b>Required</b></td>
  4473. </tr>
  4474. <tr>
  4475. <td valign="top">base</td>
  4476. <td valign="top">the location to store the compiled files.</td>
  4477. <td valign="top" align="center">Yes</td>
  4478. </tr>
  4479. <tr>
  4480. <td valign="top">classname</td>
  4481. <td valign="top">the class for which to run <code>rmic</code>.</td>
  4482. <td valign="top" align="center">No</td>
  4483. </tr>
  4484. <tr>
  4485. <td valign="top">filtering</td>
  4486. <td valign="top">indicates whether token filtering should take place</td>
  4487. <td valign="top" align="center">No</td>
  4488. </tr>
  4489. <tr>
  4490. <td valign="top">sourcebase</td>
  4491. <td valign="top">Pass the &quot;-keepgenerated&quot; flag to rmic and
  4492. move the generated source file to the base directory.</td>
  4493. <td align="center" valign="top">No</td>
  4494. </tr>
  4495. <tr>
  4496. <td valign="top">stubversion</td>
  4497. <td valign="top">Specify the JDK version for the generated stub code.
  4498. Specify &quot;1.1&quot; to pass the &quot;-v1.1&quot; option to rmic.</td>
  4499. <td align="center" valign="top">No</td>
  4500. </tr>
  4501. <tr>
  4502. <td valign="top">classpath</td>
  4503. <td valign="top">The classpath to use during compilation</td>
  4504. <td align="center" valign="top">No</td>
  4505. </tr>
  4506. <tr>
  4507. <td valign="top">classpathref</td>
  4508. <td valign="top">The classpath to use during compilation, given as <a
  4509. href="#references">reference</a> to a PATH defined elsewhere</td>
  4510. <td align="center" valign="top">No</td>
  4511. </tr>
  4512. <tr>
  4513. <td valign="top">includes</td>
  4514. <td valign="top">comma separated list of patterns of files that must be
  4515. included. All files are included when omitted.</td>
  4516. <td valign="top" align="center">No</td>
  4517. </tr>
  4518. <tr>
  4519. <td valign="top">includesfile</td>
  4520. <td valign="top">the name of a file. Each line of this file is
  4521. taken to be an include pattern</td>
  4522. <td valign="top" align="center">No</td>
  4523. </tr>
  4524. <tr>
  4525. <td valign="top">excludes</td>
  4526. <td valign="top">comma separated list of patterns of files that must be
  4527. excluded. No files (except default excludes) are excluded when omitted.</td>
  4528. <td valign="top" align="center">No</td>
  4529. </tr>
  4530. <tr>
  4531. <td valign="top">excludesfile</td>
  4532. <td valign="top">the name of a file. Each line of this file is
  4533. taken to be an exclude pattern</td>
  4534. <td valign="top" align="center">No</td>
  4535. </tr>
  4536. <tr>
  4537. <td valign="top">defaultexcludes</td>
  4538. <td valign="top">indicates whether default excludes should be used or not
  4539. (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when omitted.</td>
  4540. <td valign="top" align="center">No</td>
  4541. </tr>
  4542. <tr>
  4543. <td valign="top">verify</td>
  4544. <td valign="top">check that classes implement Remote before handing them
  4545. to rmic (default is false)</td>
  4546. <td align="center" valign="top">No</td>
  4547. </tr>
  4548. <tr>
  4549. <td valign="top">iiop</td>
  4550. <td valign="top">indates that portable (RMI/IIOP) stubs should be generated</td>
  4551. <td align="center" valign="top">No</td>
  4552. </tr>
  4553. <tr>
  4554. <td valign="top">iiopopts</td>
  4555. <td valign="top">additional arguments for IIOP class generation</td>
  4556. <td align="center" valign="top">No</td>
  4557. </tr>
  4558. <tr>
  4559. <td valign="top">idl</td>
  4560. <td valign="top">indates that IDL output files should be generated</td>
  4561. <td align="center" valign="top">No</td>
  4562. </tr>
  4563. <tr>
  4564. <td valign="top">idlopts</td>
  4565. <td valign="top">additional arguments for IDL file generation</td>
  4566. <td align="center" valign="top">No</td>
  4567. </tr>
  4568. <tr>
  4569. <td valign="top">debug</td>
  4570. <td valign="top">generate debug info (passes -g to rmic). Defaults to false.</td>
  4571. <td align="center" valign="top">No</td>
  4572. </tr>
  4573. </table>
  4574. <h3>Parameters specified as nested elements</h3>
  4575. <h4>classpath</h4>
  4576. <p><code>Rmic</code>'s <i>classpath</i> attribute is a <a
  4577. href="#path">PATH like structure</a> and can also be set via a nested
  4578. <i>classpath</i> elements.</p>
  4579. <h3>Examples</h3>
  4580. <pre> &lt;rmic classname=&quot;com.xyz.FooBar&quot; base=&quot;${build}/classes&quot;/&gt;</pre>
  4581. <p>runs the rmic compiler for the class <code>com.xyz.FooBar</code>. The
  4582. compiled files will be stored in the directory <code>${build}/classes</code>.</p>
  4583. <pre> &lt;rmic base=&quot;${build}/classes&quot; includes=&quot;**/Remote*.class&quot;/&gt;</pre>
  4584. <p>runs the rmic compiler for all classes with <code>.class</code>
  4585. files below <code>${build}/classes</code> whose classname starts with
  4586. <i>Remote</i>. The compiled files will be stored in the directory
  4587. <code>${build}/classes</code>.</p>
  4588. <hr>
  4589. <h2><a name="signjar">SignJar</a></h2>
  4590. <h3>Description</h3>
  4591. <p>Signs a jar or zip file with the javasign command line tool.</p>
  4592. <h3>Parameters</h3>
  4593. <table border="1" cellpadding="2" cellspacing="0">
  4594. <tr>
  4595. <td valign="top"><b>Attribute</b></td>
  4596. <td valign="top"><b>Description</b></td>
  4597. <td align="center" valign="top"><b>Required</b></td>
  4598. </tr>
  4599. <tr>
  4600. <td valign="top">jar</td>
  4601. <td valign="top">the jar file to sign</td>
  4602. <td valign="top" align="center">Yes.</td>
  4603. </tr>
  4604. <tr>
  4605. <td valign="top">alias</td>
  4606. <td valign="top">the alias to sign under</td>
  4607. <td valign="top" align="center">Yes.</td>
  4608. </tr>
  4609. <tr>
  4610. <td valign="top">storepass</td>
  4611. <td valign="top">password for keystore integrity.</td>
  4612. <td valign="top" align="center">Yes.</td>
  4613. </tr>
  4614. <tr>
  4615. <td valign="top">keystore</td>
  4616. <td valign="top">keystore location</td>
  4617. <td valign="top" align="center">No</td>
  4618. </tr>
  4619. <tr>
  4620. <td valign="top">storetype</td>
  4621. <td valign="top">keystore type</td>
  4622. <td valign="top" align="center">No</td>
  4623. </tr>
  4624. <tr>
  4625. <td valign="top">keypass</td>
  4626. <td valign="top">password for private key (if different)</td>
  4627. <td valign="top" align="center">No</td>
  4628. </tr>
  4629. <tr>
  4630. <td valign="top">sigfile</td>
  4631. <td valign="top">name of .SF/.DSA file</td>
  4632. <td valign="top" align="center">No</td>
  4633. </tr>
  4634. <tr>
  4635. <td valign="top">signedjar</td>
  4636. <td valign="top">name of signed JAR file</td>
  4637. <td valign="top" align="center">No</td>
  4638. </tr>
  4639. <tr>
  4640. <td valign="top">verbose</td>
  4641. <td valign="top">(true | false) verbose output when signing</td>
  4642. <td valign="top" align="center">No</td>
  4643. </tr>
  4644. <tr>
  4645. <td valign="top">internalsf</td>
  4646. <td valign="top">(true | false) include the .SF file inside the signature
  4647. block</td>
  4648. <td valign="top" align="center">No</td>
  4649. </tr>
  4650. <tr>
  4651. <td valign="top">sectionsonly</td>
  4652. <td valign="top">(true | false) don't compute hash of entire manifest</td>
  4653. <td valign="top" align="center">No</td>
  4654. </tr>
  4655. </table>
  4656. <h3>Examples</h3>
  4657. <blockquote>
  4658. <p><code>&lt;signjar jar=&quot;${dist}/lib/ant.jar&quot;
  4659. alias=&quot;apache-group&quot; storepass=&quot;secret&quot;/&gt;</code></p>
  4660. </blockquote>
  4661. <p>signs the ant.jar with alias &quot;apache-group&quot; accessing the
  4662. keystore and private key via &quot;secret&quot; password.</p>
  4663. <hr>
  4664. <h2><a name="style">Style</a></h2>
  4665. <h3>Description</h3>
  4666. <p>Process a set of documents via XSLT.</p>
  4667. <p>This is useful for building views of XML based documentation,
  4668. or in generating code.</p>
  4669. <p>It is possible to refine the set of files that are being copied. This can be
  4670. done with the <i>includes</i>, <i>includesfile</i>, <i>excludes</i>, <i>excludesfile</i> and <i>defaultexcludes</i>
  4671. attributes. With the <i>includes</i> or <i>includesfile</i> attribute you specify the files you want to
  4672. have included by using patterns. The <i>exclude</i> or <i>excludesfile</i> attribute is used to specify
  4673. the files you want to have excluded. This is also done with patterns. And
  4674. finally with the <i>defaultexcludes</i> attribute, you can specify whether you
  4675. want to use default exclusions or not. See the section on <a
  4676. href="#directorybasedtasks">directory based tasks</a>, on how the
  4677. inclusion/exclusion of files works, and how to write patterns.</p>
  4678. <p>This task forms an implicit <a href="#fileset">FileSet</a> and supports all
  4679. attributes of <code>&lt;fileset&gt;</code> (<code>dir</code> becomes <code>basedir</code>)
  4680. as well as the nested <code>&lt;include&gt;</code>, <code>&lt;exclude&gt;</code>
  4681. and <code>&lt;patternset&gt;</code> elements.</p>
  4682. <p>Style supports the use of a &lt;param&gt; element which is use to pass values
  4683. to an &lt;xsl:param&gt; declaration.</p>
  4684. <h3>Parameters</h3>
  4685. <table border="1" cellpadding="2" cellspacing="0">
  4686. <tr>
  4687. <td valign="top"><b>Attribute</b></td>
  4688. <td valign="top"><b>Description</b></td>
  4689. <td align="center" valign="top"><b>Required</b></td>
  4690. </tr>
  4691. <tr>
  4692. <td valign="top">basedir</td>
  4693. <td valign="top">where to find the source xml file.</td>
  4694. <td align="center" valign="top">Yes</td>
  4695. </tr>
  4696. <tr>
  4697. <td valign="top">destdir</td>
  4698. <td valign="top">directory where to store the results.</td>
  4699. <td align="center" valign="top">Yes</td>
  4700. </tr>
  4701. <tr>
  4702. <td valign="top">extension</td>
  4703. <td valign="top">desired file extension to be used for the targets. If not
  4704. specified, the default is &quot;html&quot;.</td>
  4705. <td align="center" valign="top">No</td>
  4706. </tr>
  4707. <tr>
  4708. <td valign="top">style</td>
  4709. <td valign="top">name of the stylesheet to use.</td>
  4710. <td align="center" valign="top">Yes</td>
  4711. </tr>
  4712. <tr>
  4713. <td valign="top">processor</td>
  4714. <td valign="top">name of the XSLT processor to use. Permissible values are
  4715. &quot;trax&quot; for a TraX compliant processor, &quot;xslp&quot; for the
  4716. XSL:P processor, &quot;xalan&quot; for the Apache XML Xalan (version 1)
  4717. processor, or the name of an arbitrary XSLTLiaison class. Defaults to trax,
  4718. followed by xslp then xalan (in that order). The first one found in your
  4719. class path is the one that is used.</td>
  4720. <td align="center" valign="top">No</td>
  4721. </tr>
  4722. <tr>
  4723. <td valign="top">includes</td>
  4724. <td valign="top">comma separated list of patterns of files that must be included.
  4725. All files are included when omitted.</td>
  4726. <td valign="top" align="center">No</td>
  4727. </tr>
  4728. <tr>
  4729. <td valign="top">includesfile</td>
  4730. <td valign="top">the name of a file. Each line of this file is taken to be
  4731. an include pattern</td>
  4732. <td valign="top" align="center">No</td>
  4733. </tr>
  4734. <tr>
  4735. <td valign="top">excludes</td>
  4736. <td valign="top">comma separated list of patterns of files that must be excluded.
  4737. No files (except default excludes) are excluded when omitted.</td>
  4738. <td valign="top" align="center">No</td>
  4739. </tr>
  4740. <tr>
  4741. <td valign="top">excludesfile</td>
  4742. <td valign="top">the name of a file. Each line of this file is taken to be
  4743. an exclude pattern</td>
  4744. <td valign="top" align="center">No</td>
  4745. </tr>
  4746. <tr>
  4747. <td valign="top">defaultexcludes</td>
  4748. <td valign="top">indicates whether default excludes should be used or not
  4749. (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when omitted.</td>
  4750. <td valign="top" align="center">No</td>
  4751. </tr>
  4752. <tr>
  4753. <td valign="top">in</td>
  4754. <td valign="top">specifies a single XML document to be styled. Should be used
  4755. with the out attribute.</td>
  4756. <td valign="top" align="center">No</td>
  4757. </tr>
  4758. <tr>
  4759. <td valign="top">out</td>
  4760. <td valign="top">specifies the output name for the sytled result from the
  4761. in attribute.</td>
  4762. <td valign="top" align="center">No</td>
  4763. </tr>
  4764. </table>
  4765. <h3>Parameters specified as nested elements</h3>
  4766. <h4>param</h4>
  4767. <p>Param is used to pass a parameter to the XSL stylesheet.</p>
  4768. <h4>Parameters</h4>
  4769. <table width="60%" border="1" cellpadding="2" cellspacing="0">
  4770. <tr>
  4771. <td valign="top"><b>Attribute</b></td>
  4772. <td valign="top"><b>Description</b></td>
  4773. <td align="center" valign="top"><b>Required</b></td>
  4774. </tr>
  4775. <tr>
  4776. <td valign="top">name</td>
  4777. <td valign="top">Name of the XSL parameter</td>
  4778. <td align="center" valign="top">Yes</td>
  4779. </tr>
  4780. <tr>
  4781. <td valign="top">expression</td>
  4782. <td valign="top">XSL expression to be placed into the param. To pass a text
  4783. value into the style sheet it needs to be escaped using single quotes.</td>
  4784. <td align="center" valign="top">Yes</td>
  4785. </tr>
  4786. </table>
  4787. <h3>Examples</h3>
  4788. <blockquote>
  4789. <p>
  4790. <pre>
  4791. &lt;style basedir=&quot;doc&quot; destdir=&quot;build/doc&quot;
  4792. extension=&quot;html&quot; style=&quot;style/apache.xsl&quot;/&gt;</pre>
  4793. <h4><br>
  4794. Using XSL parameters<br>
  4795. </h4>
  4796. <pre>&lt;style basedir=&quot;doc&quot; destdir=&quot;build/doc&quot;
  4797. extension=&quot;html&quot; style=&quot;style/apache.xsl&quot;&gt;
  4798. &lt;param name=&quot;date&quot; expression=&quot;'07-01-2000'&quot;/&gt;
  4799. &lt;/style&gt;</pre>
  4800. <p>This will replace an xsl:param definition&lt;xsl:param name="date"&gt;&lt;/xsl:param&gt;
  4801. with the text value 07-01-2000 </p>
  4802. </blockquote>
  4803. <hr>
  4804. <h2><a name="tar">Tar</a></h2>
  4805. <h3>Description</h3>
  4806. <p>Creates a tar archive.</p>
  4807. <p>The <i>basedir</i> attribute is the reference directory from where to tar.</p>
  4808. <p>It is possible to refine the set of files that are being tarred. This can be
  4809. done with the <i>includes</i>, <i>includesfile</i>, <i>excludes</i>, <i>excludesfile</i> and <i>defaultexcludes</i>
  4810. attributes. With the <i>includes</i> or <i>includesfile</i> attribute you specify the files you want to
  4811. have included by using patterns. The <i>exclude</i> or <i>excludesfile</i> attribute is used to specify
  4812. the files you want to have excluded. This is also done with patterns. And
  4813. finally with the <i>defaultexcludes</i> attribute, you can specify whether you
  4814. want to use default exclusions or not. See the section on <a
  4815. href="#directorybasedtasks">directory based tasks</a>, on how the
  4816. inclusion/exclusion of files works, and how to write patterns.</p>
  4817. <p>This task forms an implicit <a href="#fileset">FileSet</a> and
  4818. supports all attributes of <code>&lt;fileset&gt;</code>
  4819. (<code>dir</code> becomes <code>basedir</code>) as well as the nested
  4820. <code>&lt;include&gt;</code>, <code>&lt;exclude&gt;</code> and
  4821. <code>&lt;patternset&gt;</code> elements.</p>
  4822. <p>Note that this task does not perform compression. You might want to use the <a href="#gzip">GZip</a>
  4823. task to come up with a .tar.gz package.</p>
  4824. <h3>Parameters</h3>
  4825. <table border="1" cellpadding="2" cellspacing="0">
  4826. <tr>
  4827. <td valign="top"><b>Attribute</b></td>
  4828. <td valign="top"><b>Description</b></td>
  4829. <td valign="top" align="center"><b>Required</b></td>
  4830. </tr>
  4831. <tr>
  4832. <td valign="top">tarfile</td>
  4833. <td valign="top">the tar-file to create.</td>
  4834. <td align="center" valign="top">Yes</td>
  4835. </tr>
  4836. <tr>
  4837. <td valign="top">basedir</td>
  4838. <td valign="top">the directory from which to zip the files.</td>
  4839. <td align="center" valign="top">Yes</td>
  4840. </tr>
  4841. <tr>
  4842. <td valign="top">includes</td>
  4843. <td valign="top">comma separated list of patterns of files that must be
  4844. included. All files are included when omitted.</td>
  4845. <td valign="top" align="center">No</td>
  4846. </tr>
  4847. <tr>
  4848. <td valign="top">includesfile</td>
  4849. <td valign="top">the name of a file. Each line of this file is
  4850. taken to be an include pattern</td>
  4851. <td valign="top" align="center">No</td>
  4852. </tr>
  4853. <tr>
  4854. <td valign="top">excludes</td>
  4855. <td valign="top">comma separated list of patterns of files that must be
  4856. excluded. No files (except default excludes) are excluded when omitted.</td>
  4857. <td valign="top" align="center">No</td>
  4858. </tr>
  4859. <tr>
  4860. <td valign="top">excludesfile</td>
  4861. <td valign="top">the name of a file. Each line of this file is
  4862. taken to be an exclude pattern</td>
  4863. <td valign="top" align="center">No</td>
  4864. </tr>
  4865. <tr>
  4866. <td valign="top">defaultexcludes</td>
  4867. <td valign="top">indicates whether default excludes should be used or not
  4868. (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when omitted.</td>
  4869. <td valign="top" align="center">No</td>
  4870. </tr>
  4871. </table>
  4872. <h3>Examples</h3>
  4873. <pre> &lt;tar tarfile=&quot;${dist}/manual.tar&quot; basedir=&quot;htdocs/manual&quot;/&gt;
  4874. &lt;gzip zipfile=&quot;${dist}/manual.tar.gz&quot; src=&quot;${dist}/manual.tar&quot;/&gt;</pre>
  4875. <p>tars all files in the <code>htdocs/manual</code> directory into a file called <code>manual.tar</code>
  4876. in the <code>${dist}</code> directory, then applies the gzip task to compress
  4877. it.</p>
  4878. <pre> &lt;tar tarfile=&quot;${dist}/manual.tar&quot;
  4879. basedir=&quot;htdocs/manual&quot;
  4880. excludes=&quot;mydocs/**, **/todo.html&quot;
  4881. /&gt;</pre>
  4882. <p>tars all files in the <code>htdocs/manual</code> directory into a file called <code>manual.tar</code>
  4883. in the <code>${dist}</code> directory. Files in the directory <code>mydocs</code>,
  4884. or files with the name <code>todo.html</code> are excluded.</p>
  4885. <hr>
  4886. <h2><a name="taskdef">Taskdef</a></h2>
  4887. <h3>Description</h3>
  4888. <p>Adds a task definition to the current project, such that this new task can be
  4889. used in the current project. Two attributes are needed, the name that identifies
  4890. this task uniquely, and the full name of the class (including the packages) that
  4891. implements this task.</p>
  4892. <p>Taskdef should be used to add your own tasks to the system. See also &quot;<a
  4893. href="#writingowntask">Writing your own task</a>&quot;.</p>
  4894. <h3>Parameters</h3>
  4895. <table border="1" cellpadding="2" cellspacing="0">
  4896. <tr>
  4897. <td valign="top"><b>Attribute</b></td>
  4898. <td valign="top"><b>Description</b></td>
  4899. <td align="center" valign="top"><b>Required</b></td>
  4900. </tr>
  4901. <tr>
  4902. <td valign="top">name</td>
  4903. <td valign="top">the name of the task</td>
  4904. <td valign="top" align="center">Yes</td>
  4905. </tr>
  4906. <tr>
  4907. <td valign="top">classname</td>
  4908. <td valign="top">the full class name implementing the task</td>
  4909. <td valign="top" align="center">Yes</td>
  4910. </tr>
  4911. <tr>
  4912. <td valign="top">classpath</td> <td valign="top">the classpath to
  4913. use when looking up <code>classname</code>.</td> <td
  4914. align="center" valign="top">No</td>
  4915. </tr>
  4916. </table>
  4917. <h3>Parameters specified as nested elements</h3>
  4918. <h4>classpath</h4>
  4919. <p><code>Taskdef</code>'s <i>classpath</i> attribute is a <a
  4920. href="#path">PATH like structure</a> and can also be set via a nested
  4921. <i>classpath</i> element.</p>
  4922. <h3>Examples</h3>
  4923. <pre> &lt;taskdef name=&quot;myjavadoc&quot; classname=&quot;com.mydomain.JavadocTask&quot;/&gt;</pre>
  4924. <p>makes a task called <code>myjavadoc</code> available to Ant. The class <code>com.mydomain.JavadocTask</code>
  4925. implements the task.</p>
  4926. <hr>
  4927. <h2><a name="touch">Touch</a></h2>
  4928. <h3>Description</h3>
  4929. <p>Changes the modification time of a file and possibly creates it at
  4930. the same time.</p>
  4931. <p>For JDK 1.1 only the creation of new files with a modification time
  4932. of now works, all other cases will emit a warning.</p>
  4933. <h3>Parameters</h3>
  4934. <table border="1" cellpadding="2" cellspacing="0">
  4935. <tr>
  4936. <td valign="top"><b>Attribute</b></td>
  4937. <td valign="top"><b>Description</b></td>
  4938. <td align="center" valign="top"><b>Required</b></td>
  4939. </tr>
  4940. <tr>
  4941. <td valign="top">file</td>
  4942. <td valign="top">the name of the file</td>
  4943. <td valign="top" align="center">Yes</td>
  4944. </tr>
  4945. <tr>
  4946. <td valign="top">millis</td>
  4947. <td valign="top">specifies the new modification time of the file
  4948. in milliseconds since midnight Jan 1 1970</td>
  4949. <td valign="top" align="center">No</td>
  4950. </tr>
  4951. <tr>
  4952. <td valign="top">datetime</td>
  4953. <td valign="top">specifies the new modification time of the file
  4954. in the format MM/DD/YYYY HH:MM AM_or_PM.</td>
  4955. <td valign="top" align="center">No</td>
  4956. </tr>
  4957. </table>
  4958. <p>If both <code>millis</code> and <code>datetime</code> are omitted
  4959. the current time is assumed.</p>
  4960. <h3>Examples</h3>
  4961. <pre> &lt;touch file=&quot;myfile&quot;/&gt;</pre>
  4962. <p>creates <code>myfile</code> if it doesn't exist and changes the
  4963. modification time to the current time.</p>
  4964. <pre> &lt;touch file=&quot;myfile&quot; datetime=&quot;06/28/2000 2:02 pm&quot;/&gt;</pre>
  4965. <p>creates <code>myfile</code> if it doesn't exist and changes the
  4966. modification time to Jun, 28 2000 2:02 pm (14:02 for those used to 24
  4967. hour times).</p>
  4968. <hr>
  4969. <h2><a name="tstamp">Tstamp</a></h2>
  4970. <h3>Description</h3>
  4971. <p>Sets the DSTAMP, TSTAMP and TODAY properties in the current project. The
  4972. DSTAMP is in the &quot;yyyymmdd&quot; format, the TSTAMP is in the &quot;hhmm&quot;
  4973. format and TODAY is &quot;month day year&quot;.</p>
  4974. <p>These properties can be used in the buildfile, for instance, to create
  4975. timestamped filenames or used to replace placeholder tags inside documents to
  4976. indicate, for example, the release date. The best place for this task is in your
  4977. initialization target.</p>
  4978. <h3>Parameters</h3>
  4979. <table border="1" cellpadding="2" cellspacing="0">
  4980. <tr>
  4981. <td valign="top"><b>Attribute</b></td>
  4982. <td valign="top"><b>Description</b></td>
  4983. <td align="center" valign="top"><b>Required</b></td>
  4984. </tr>
  4985. <tr> <td colspan="3"/> No parameters</td>
  4986. </tr>
  4987. </table>
  4988. <h3>Nested Elements</h3>
  4989. The tstamp task supports a format nested element which allows a property to be
  4990. given the current date and time in a given format. The date/time patterns are as defined in the Java
  4991. SimpleDateFormat class.
  4992. <p>
  4993. <table width="60%" border="1" cellpadding="2" cellspacing="0">
  4994. <tr>
  4995. <td valign="top"><b>Attribute</b></td>
  4996. <td valign="top"><b>Description</b></td>
  4997. <td align="center" valign="top"><b>Required</b></td>
  4998. </tr>
  4999. <tr>
  5000. <td valign="top">property</td>
  5001. <td valign="top">
  5002. The property which is to receive the date/time string in the given pattern
  5003. </td>
  5004. <td align="center" valign="top">Yes</td>
  5005. </tr>
  5006. <tr>
  5007. <td valign="top">pattern</td>
  5008. <td valign="top">The date/time pattern to be used. The values are defined by the Java
  5009. SimpleDateFormat class</td>
  5010. <td align="center" valign="top">Yes</td>
  5011. </tr>
  5012. </table>
  5013. <h3>Examples</h3>
  5014. <p> Set the standard DSTAMP, TSTAMP and TODAY properties according to the formats above
  5015. <pre> &lt;tstamp/&gt;</pre>
  5016. <p> As for the above example, set the standard properties and also set the property
  5017. &quot;TODAY_UK&quot; with the date/time pattern &quot;d MMM yyyy&quot;
  5018. <pre> &lt;tstamp&gt;
  5019. &lt;format property=&quot;TODAY_UK&quot; pattern=&quot;d MMMM yyyy&quot;&gt;
  5020. &lt;/tstamp&gt;
  5021. </pre>
  5022. <hr>
  5023. <h2><a name="uptodate">Uptodate</a></h2>
  5024. <h3>Description</h3>
  5025. <p>Sets a property if a target files are more up to date than a set of
  5026. Source files. Source files are specified by nested &lt;srcfiles&gt;
  5027. elements, these are <a href="#fileset">FileSet</a>s, while target
  5028. files are specified using a nested <a href="#mapper">mapper</a>
  5029. element.</p>
  5030. <p>The value part of the property being set is <i>true</i> if the
  5031. timestamp of the target files is more recent than the timestamp of
  5032. every corresponding source file.</p>
  5033. <p>The default behavior is to use a <a href="#merge-mapper">merge
  5034. mapper</a> whith the <code>to</code> attribute set to the value of the
  5035. targetfile attribute.</p>
  5036. <p>Normally, this task is used to set properties that are useful to avoid target
  5037. execution depending on the relative age of the specified files.</p>
  5038. <h3>Parameters</h3>
  5039. <table border="1" cellpadding="2" cellspacing="0">
  5040. <tr>
  5041. <td valign="top"><b>Attribute</b></td>
  5042. <td valign="top"><b>Description</b></td>
  5043. <td align="center" valign="top"><b>Required</b></td>
  5044. </tr>
  5045. <tr>
  5046. <td valign="top">property</td>
  5047. <td valign="top">the name of the property to set.</td>
  5048. <td valign="top" align="center">Yes</td>
  5049. </tr>
  5050. <tr>
  5051. <td valign="top">targetfile</td>
  5052. <td valign="top">the file for which we want to determine the status.</td>
  5053. <td valign="top" align="center">Yes, unless a nested mapper element is
  5054. present.</td>
  5055. </tr>
  5056. </table>
  5057. <h3>Examples</h3>
  5058. <pre> &lt;uptodate property=&quot;xmlBuild.notRequired&quot; targetfile=&quot;${deploy}\xmlClasses.jar&quot; &gt;
  5059. &lt;srcfiles dir= &quot;${src}/xml&quot; includes=&quot;**/*.dtd&quot;/&gt;
  5060. &lt;/uptodate&gt;</pre>
  5061. <p>sets the property <code><i>xmlBuild.notRequired</i></code> to the value &quot;true&quot;
  5062. if the <i>${deploy}/xmlClasses.jar</i> is more up to date than any of the DTD files in the <i>${src}/xml</i> directory.</p>
  5063. <p>This can be written as
  5064. <pre> &lt;uptodate property=&quot;xmlBuild.notRequired&quot; &gt;
  5065. &lt;srcfiles dir= &quot;${src}/xml&quot; includes=&quot;**/*.dtd&quot;/&gt;
  5066. &lt;mapper type=&quot;merge&quot; to=&quot;${deploy}\xmlClasses.jar&quot;/&gt;
  5067. &lt;/uptodate&gt;</pre>
  5068. <p>as well.</p>
  5069. <hr>
  5070. <h2><a name="unzip">Unjar/Unwar/Unzip</a></h2>
  5071. <h3>Description</h3>
  5072. <p>Unzips a zip-, war- or jarfile.</p>
  5073. <p>For JDK 1.1 &quot;last modified time&quot; field is set to current time instead of being
  5074. carried from zipfile.</p>
  5075. <p>File permissions will not be restored on extracted files.</p>
  5076. <h3>Parameters</h3>
  5077. <table border="1" cellpadding="2" cellspacing="0">
  5078. <tr>
  5079. <td valign="top"><b>Attribute</b></td>
  5080. <td valign="top"><b>Description</b></td>
  5081. <td align="center" valign="top"><b>Required</b></td>
  5082. </tr>
  5083. <tr>
  5084. <td valign="top">src</td>
  5085. <td valign="top">zipfile to expand.</td>
  5086. <td align="center" valign="top">Yes</td>
  5087. </tr>
  5088. <tr>
  5089. <td valign="top">dest</td>
  5090. <td valign="top">directory where to store the expanded files.</td>
  5091. <td align="center" valign="top">Yes</td>
  5092. </tr>
  5093. </table>
  5094. <h3>Examples</h3>
  5095. <blockquote>
  5096. <p><code>&lt;unzip src=&quot;${tomcat_src}/tools-src.zip&quot; dest=&quot;${tools.home}&quot;
  5097. /&gt;</code></p>
  5098. </blockquote>
  5099. <hr>
  5100. <h2><a name="untar">Untar</a></h2>
  5101. <h3>Description</h3>
  5102. <p>Untars a tarfile.</p>
  5103. <p>File permissions will not be restored on extracted files.</p>
  5104. <p>For JDK 1.1 &quot;last modified time&quot; field is set to current time instead of being
  5105. carried from tarfile.</p>
  5106. <h3>Parameters</h3>
  5107. <table border="1" cellpadding="2" cellspacing="0">
  5108. <tr>
  5109. <td valign="top"><b>Attribute</b></td>
  5110. <td valign="top"><b>Description</b></td>
  5111. <td align="center" valign="top"><b>Required</b></td>
  5112. </tr>
  5113. <tr>
  5114. <td valign="top">src</td>
  5115. <td valign="top">tarfile to expand.</td>
  5116. <td align="center" valign="top">Yes</td>
  5117. </tr>
  5118. <tr>
  5119. <td valign="top">dest</td>
  5120. <td valign="top">directory where to store the expanded files.</td>
  5121. <td align="center" valign="top">Yes</td>
  5122. </tr>
  5123. </table>
  5124. <h3>Examples</h3>
  5125. <blockquote>
  5126. <p><code>
  5127. &lt;gunzip src=&quot;tools.tar.gz&quot;/&gt;<br>
  5128. &lt;untar src=&quot;tools.tar&quot; dest=&quot;${tools.home}&quot;/&gt;
  5129. </code></p>
  5130. </blockquote>
  5131. <hr>
  5132. <h2><a name="war">War</a></h2>
  5133. <h3>Description</h3>
  5134. <p>An extension of the <a href="#jar">Jar</a> task with special
  5135. treatment for files that should end up in the
  5136. <code>WEB-INF/lib</code>, <code>WEB-INF/classes</code> or
  5137. <code>WEB-INF</code> directories of the Web Application Archive.
  5138. <p>(The War task is a shortcut for specifying the particular layout of a WAR file.
  5139. The same thing can be accomplished by using the <i>prefix</i> and <i>fullpath</i>
  5140. attributes of zipfilesets in a Zip or Jar task.)</p>
  5141. <p>The extended zipfileset element from the zip task (with attributes <i>prefix</i>, <i>fullpath</i>, and <i>src</i>) is available in the War task.</p>
  5142. <h3>Parameters</h3>
  5143. <table border="1" cellpadding="2" cellspacing="0">
  5144. <tr>
  5145. <td valign="top"><b>Attribute</b></td>
  5146. <td valign="top"><b>Description</b></td>
  5147. <td align="center" valign="top"><b>Required</b></td>
  5148. </tr>
  5149. <tr>
  5150. <td valign="top">warfile</td>
  5151. <td valign="top">the war-file to create.</td>
  5152. <td valign="top" align="center">Yes</td>
  5153. </tr>
  5154. <tr>
  5155. <td valign="top">webxml</td>
  5156. <td valign="top">The deployment descriptor to use (WEB-INF/web.xml).</td>
  5157. <td valign="top" align="center">Yes</td>
  5158. </tr>
  5159. <tr>
  5160. <td valign="top">basedir</td>
  5161. <td valign="top">the directory from which to jar the files.</td>
  5162. <td valign="top" align="center">No</td>
  5163. </tr>
  5164. <tr>
  5165. <td valign="top">compress</td>
  5166. <td valign="top">Not only store data but also compress them, defaults to true</td>
  5167. <td align="center" valign="top">No</td>
  5168. </tr>
  5169. <tr>
  5170. <td valign="top">includes</td>
  5171. <td valign="top">comma separated list of patterns of files that must be
  5172. included. All files are included when omitted.</td>
  5173. <td valign="top" align="center">No</td>
  5174. </tr>
  5175. <tr>
  5176. <td valign="top">includesfile</td>
  5177. <td valign="top">the name of a file. Each line of this file is
  5178. taken to be an include pattern</td>
  5179. <td valign="top" align="center">No</td>
  5180. </tr>
  5181. <tr>
  5182. <td valign="top">excludes</td>
  5183. <td valign="top">comma separated list of patterns of files that must be
  5184. excluded. No files (except default excludes) are excluded when omitted.</td>
  5185. <td valign="top" align="center">No</td>
  5186. </tr>
  5187. <tr>
  5188. <td valign="top">excludesfile</td>
  5189. <td valign="top">the name of a file. Each line of this file is
  5190. taken to be an exclude pattern</td>
  5191. <td valign="top" align="center">No</td>
  5192. </tr>
  5193. <tr>
  5194. <td valign="top">defaultexcludes</td>
  5195. <td valign="top">indicates whether default excludes should be used or not
  5196. (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when omitted.</td>
  5197. <td valign="top" align="center">No</td>
  5198. </tr>
  5199. <tr>
  5200. <td valign="top">manifest</td>
  5201. <td valign="top">the manifest file to use.</td>
  5202. <td valign="top" align="center">No</td>
  5203. </tr>
  5204. <tr>
  5205. <td valign="top">whenempty</td>
  5206. <td valign="top">Behavior to use if no files match.</td>
  5207. <td valign="top" align="center">No</td>
  5208. </tr>
  5209. </table>
  5210. <h3>Nested elements</h3>
  5211. <h4>lib</h4>
  5212. <p>The nested <code>lib</code> element specifies a <a
  5213. href="#fileset">FileSet</a>. All files included in this fileset will
  5214. end up in the <code>WEB-INF/lib</code> directory of the war file.</p>
  5215. <h4>classes</h4>
  5216. <p>The nested <code>classes</code> element specifies a <a
  5217. href="#fileset">FileSet</a>. All files included in this fileset will
  5218. end up in the <code>WEB-INF/classes</code> directory of the war file.</p>
  5219. <h4>webinf</h4>
  5220. <p>The nested <code>webinf</code> element specifies a <a
  5221. href="#fileset">FileSet</a>. All files included in this fileset will
  5222. end up in the <code>WEB-INF</code> directory of the war file. If this
  5223. fileset includes a file named <code>web.xml</code>, the file is
  5224. ignored and you will get a warning.</p>
  5225. <h3>Examples</h3>
  5226. <p>Assume the following structure in the project's base directory:
  5227. <pre>
  5228. thirdparty/libs/jdbc1.jar
  5229. thirdparty/libs/jdbc2.jar
  5230. build/main/com/myco/myapp/Servlet.class
  5231. src/metadata/myapp.xml
  5232. src/html/myapp/index.html
  5233. src/jsp/myapp/front.jsp
  5234. src/graphics/images/gifs/small/logo.gif
  5235. src/graphics/images/gifs/large/logo.gif
  5236. </pre>
  5237. then the war file <code>myapp.war</code> created with
  5238. <pre>
  5239. &lt;war warfile=&quot;myapp.war&quot; webxml=&quot;src/metadata/myapp.xml&quot;&gt;
  5240. &lt;fileset dir=&quot;src/html/myapp&quot;/&gt;
  5241. &lt;fileset dir=&quot;src/jsp/myapp&quot;/&gt;
  5242. &lt;lib dir=&quot;thirdparty/libs&quot;&gt;
  5243. &lt;exclude name=&quot;jdbc1.jar&quot;/&gt;
  5244. &lt;/lib&gt;
  5245. &lt;classes dir=&quot;build/main&quot;/&gt;
  5246. &lt;zipfileset dir=&quot;src/graphics/images/gifs&quot;
  5247. prefix="images"/&gt;
  5248. &lt;/war&gt;
  5249. </pre>
  5250. will consist of
  5251. <pre>
  5252. WEB-INF/web.xml
  5253. WEB-INF/lib/jdbc2.jar
  5254. WEB-INF/classes/com/myco/myapp/Servlet.class
  5255. META-INF/MANIFEST.MF
  5256. index.html
  5257. front.jsp
  5258. images/small/logo.gif
  5259. images/large/logo.gif
  5260. </pre>
  5261. using Ant's default manifest file. The content of
  5262. <code>WEB-INF/web.xml</code> is identical to
  5263. <code>src/metadata/myapp.xml</code>.
  5264. <hr>
  5265. <h2><a name="zip">Zip</a></h2>
  5266. <h3>Description</h3>
  5267. <p>Creates a zipfile.</p>
  5268. <p>The <i>basedir</i> attribute is the reference directory from where to zip.</p>
  5269. <p>Note that file permissions will not be stored in the resulting zipfile.</p>
  5270. <p>It is possible to refine the set of files that are being zipped. This can be
  5271. done with the <i>includes</i>, <i>includesfile</i>, <i>excludes</i>, <i>excludesfile</i> and <i>defaultexcludes</i>
  5272. attributes. With the <i>includes</i> or <i>includesfile</i> attribute you specify the files you want to
  5273. have included by using patterns. The <i>exclude</i> or <i>excludesfile</i> attribute is used to specify
  5274. the files you want to have excluded. This is also done with patterns. And
  5275. finally with the <i>defaultexcludes</i> attribute, you can specify whether you
  5276. want to use default exclusions or not. See the section on <a
  5277. href="#directorybasedtasks">directory based tasks</a>, on how the
  5278. inclusion/exclusion of files works, and how to write patterns.
  5279. <p>This task forms an implicit <a href="#fileset">FileSet</a> and
  5280. supports all attributes of <code>&lt;fileset&gt;</code>
  5281. (<code>dir</code> becomes <code>basedir</code>) as well as the nested
  5282. <code>&lt;include&gt;</code>, <code>&lt;exclude&gt;</code> and
  5283. <code>&lt;patternset&gt;</code> elements.</p>
  5284. <p>Or, you may place within it nested file sets, or references to file sets.
  5285. In this case <code>basedir</code> is optional; the implicit file set is <i>only used</i>
  5286. if <code>basedir</code> is set. You may use any mixture of the implicit file set
  5287. (with <code>basedir</code> set, and optional attributes like <code>includes</code>
  5288. and optional subelements like <code>&lt;include&gt;</code>); explicit nested
  5289. <code>&lt;fileset&gt;</code> elements so long as at least one fileset total is specified. The ZIP file will
  5290. only reflect the relative paths of files <i>within</i> each fileset. The Zip task and its derivatives know a special form of a fileset named zipfileset that has additional attributes (described below). </p>
  5291. <p>The <code>whenempty</code> parameter controls what happens when no files match.
  5292. If <code>skip</code> (the default), the ZIP is not created and a warning is issued.
  5293. If <code>fail</code>, the ZIP is not created and the build is halted with an error.
  5294. If <code>create</code>, an empty ZIP file (explicitly zero entries) is created,
  5295. which should be recognized as such by compliant ZIP manipulation tools.</p>
  5296. <h3>Parameters</h3>
  5297. <table border="1" cellpadding="2" cellspacing="0">
  5298. <tr>
  5299. <td valign="top"><b>Attribute</b></td>
  5300. <td valign="top"><b>Description</b></td>
  5301. <td valign="top" align="center"><b>Required</b></td>
  5302. </tr>
  5303. <tr>
  5304. <td valign="top">zipfile</td>
  5305. <td valign="top">the zip-file to create.</td>
  5306. <td align="center" valign="top">Yes</td>
  5307. </tr>
  5308. <tr>
  5309. <td valign="top">basedir</td>
  5310. <td valign="top">the directory from which to zip the files.</td>
  5311. <td align="center" valign="top">No</td>
  5312. </tr>
  5313. <tr>
  5314. <td valign="top">compress</td>
  5315. <td valign="top">Not only store data but also compress them, defaults to true</td>
  5316. <td align="center" valign="top">No</td>
  5317. </tr>
  5318. <tr>
  5319. <td valign="top">includes</td>
  5320. <td valign="top">comma separated list of patterns of files that must be
  5321. included. All files are included when omitted.</td>
  5322. <td valign="top" align="center">No</td>
  5323. </tr>
  5324. <tr>
  5325. <td valign="top">includesfile</td>
  5326. <td valign="top">the name of a file. Each line of this file is
  5327. taken to be an include pattern</td>
  5328. <td valign="top" align="center">No</td>
  5329. </tr>
  5330. <tr>
  5331. <td valign="top">excludes</td>
  5332. <td valign="top">comma separated list of patterns of files that must be
  5333. excluded. No files (except default excludes) are excluded when omitted.</td>
  5334. <td valign="top" align="center">No</td>
  5335. </tr>
  5336. <tr>
  5337. <td valign="top">excludesfile</td>
  5338. <td valign="top">the name of a file. Each line of this file is
  5339. taken to be an exclude pattern</td>
  5340. <td valign="top" align="center">No</td>
  5341. </tr>
  5342. <tr>
  5343. <td valign="top">defaultexcludes</td>
  5344. <td valign="top">indicates whether default excludes should be used or not
  5345. (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when omitted.</td>
  5346. <td valign="top" align="center">No</td>
  5347. </tr>
  5348. <tr>
  5349. <td valign="top">whenempty</td>
  5350. <td valign="top">Behavior when no files match.</td>
  5351. <td valign="top" align="center">No</td>
  5352. </tr>
  5353. </table>
  5354. <h3>Parameters specified as nested elements</h3>
  5355. <h4>fileset</h4>
  5356. <p>The zip task supports any number of nested <a
  5357. href="#fileset"><code>&lt;fileset&gt;</code></a> elements to specify
  5358. the files to be included in the archive.</p>
  5359. <h4>zipfileset</h4>
  5360. <p>A <code>&lt;zipfileset&gt;</code> has three additional attributes: <i>prefix</i>, <i>fullpath</i>, and <i>src</i>. The
  5361. <i>prefix</i> and <i>fullpath</i> attributes modify the location of the files when they are placed
  5362. inside the archive. If the <i>prefix</i> attribute is set, all files in the fileset are prefixed
  5363. with that path in the archive. If the <i>fullpath</i> attribute is set, the file described by the fileset is placed at that
  5364. exact location in the archive. (The <i>fullpath</i> attribute can only be set for filesets that represent a single file. The <i>prefix</i> and <i>fullpath</i> attributes cannot both be set on the same fileset.) The <i>src</i> attribute
  5365. may be used in place of the <i>dir</i> attribute to specify a zip file whose
  5366. contents will be extracted and included in the archive. As with directories, include and exclude patterns may be used to specify a subset of the zip file
  5367. for inclusion in the archive.
  5368. <h3>Examples</h3>
  5369. <pre> &lt;zip zipfile=&quot;${dist}/manual.zip&quot;
  5370. basedir=&quot;htdocs/manual&quot;
  5371. /&gt;</pre>
  5372. <p>zips all files in the <code>htdocs/manual</code> directory into a file called <code>manual.zip</code>
  5373. in the <code>${dist}</code> directory.</p>
  5374. <pre> &lt;zip zipfile=&quot;${dist}/manual.zip&quot;
  5375. basedir=&quot;htdocs/manual&quot;
  5376. excludes=&quot;mydocs/**, **/todo.html&quot;
  5377. /&gt;</pre>
  5378. <p>zips all files in the <code>htdocs/manual</code> directory. Files in the directory <code>mydocs</code>,
  5379. or files with the name <code>todo.html</code> are excluded.</p>
  5380. <pre> &lt;zip zipfile=&quot;${dist}/manual.zip&quot;
  5381. basedir=&quot;htdocs/manual&quot;
  5382. includes=&quot;api/**/*.html&quot;
  5383. excludes=&quot;**/todo.html&quot;
  5384. /&gt;</pre>
  5385. <p>zips all files in the <code>htdocs/manual</code> directory. Only html files under the directory <code>api</code>
  5386. are zipped, and files with the name <code>todo.html</code> are excluded.</p>
  5387. <pre> &lt;zip zipfile=&quot;${dist}/manual.zip&quot;&gt;
  5388. &lt;fileset dir=&quot;htdocs/manual&quot;/&gt;
  5389. &lt;fileset dir=&quot;.&quot; includes=&quot;ChangeLog.txt&quot;/&gt;
  5390. &lt;/zip&gt;</pre>
  5391. <p>zips all files in the <code>htdocs/manual</code> directory, and also adds the file <code>ChangeLog.txt</code> in the
  5392. current directory. <code>ChangeLog.txt</code> will be added to the top of the ZIP file, just as if
  5393. it had been located at <code>htdocs/manual/ChangeLog.txt</code>.</p>
  5394. <pre> &lt;zip zipfile=&quot;${dist}/manual.zip&quot;&gt;
  5395. &lt;zipfileset dir=&quot;htdocs/manual&quot; prefix=&quot;docs/user-guide&quot;/&gt;
  5396. &lt;zipfileset dir=&quot;.&quot; includes=&quot;ChangeLog27.txt&quot; fullpath=&quot;docs/ChangeLog.txt&quot;/&gt;
  5397. &lt;zipfileset src=&quot;examples.zip&quot; includes=&quot;**/*.html&quot; prefix=&quot;docs/examples&quot;/&gt;
  5398. &lt;/zip&gt;</pre>
  5399. <p>zips all files in the <code>htdocs/manual</code> directory into the <code>docs/user-guide</code> directory
  5400. in the archive, adds the file <code>ChangeLog27.txt</code> in the
  5401. current directory as <code>docs/ChangeLog.txt</code>, and includes all the html files in <code>examples.zip</code> under <code>docs/examples</code>. The archive might end up containing the files:
  5402. <pre><code> docs/user-guide/html/index.html
  5403. docs/ChangeLog.txt
  5404. docs/examples/index.html
  5405. </code></pre>
  5406. </p>
  5407. <hr>
  5408. <h2><a name="optionaltasks">Optional tasks</a></h2>
  5409. <p>The tasks listed here are not included in the ant.jar included in the binary distribution
  5410. of Ant. To use them you should download optional.jar and put in the lib-subdirectory of your
  5411. Ant-installation. Additionaly some of these tasks require external libraries to be put on
  5412. your CLASSPATH.</p>
  5413. <ul>
  5414. <li><a href="dotnet.html">.NET Tasks</a></li>
  5415. <li><a href="antlr.html">ANTLR</a></li>
  5416. <li><a href="#cab">Cab</a></li>
  5417. <li><a href="clearcase.html">Clearcase Tasks</a></li>
  5418. <li><a href="ejb.html">EJB Tasks</a></li>
  5419. <li><a href="#ftp">FTP</a></li>
  5420. <li><a href="javacc.html">JavaCC</a></li>
  5421. <li><a href="jlink.html">Jlink</a></li>
  5422. <li><a href="junit.html">JUnit</a></li>
  5423. <li><a href="native2ascii.html">Native2Ascii</a></li>
  5424. <li><a href="#netrexxc">NetRexxC</a></li>
  5425. <li><a href="propertyfile.html">PropertyFile</a></li>
  5426. <li><a href="perforce.html">Perforce Tasks</a></li>
  5427. <li><a href="#renameexts">RenameExtensions</a></li>
  5428. <li><a href="#script">Script</a></li>
  5429. <li><a href="#sound">Sound</a></li>
  5430. <li><a href="#telnet">Telnet</a></li>
  5431. <li><a href="#vssget">VssGet</a></li>
  5432. </ul>
  5433. <hr>
  5434. <h2><a name="cab">Cab</a></h2>
  5435. <h3>Description</h3>
  5436. <p>The cab task creates Microsoft cab archive files. It is invoked
  5437. similar to the <a href="#jar">jar</a> or <a href="#zip">zip</a> tasks.
  5438. This task will only work on Windows, and will be silently ignored on
  5439. other platforms. You must have the Microsoft cabarc tool available in
  5440. your executable path.</p>
  5441. <p>See the section on <a href="#directorybasedtasks">directory based
  5442. tasks</a>, on how the inclusion/exclusion of files works, and how to
  5443. write patterns.</p>
  5444. <p>This task forms an implicit <a href="#fileset">FileSet</a> and
  5445. supports all attributes of <code>&lt;fileset&gt;</code>
  5446. (<code>dir</code> becomes <code>basedir</code>) as well as the nested
  5447. <code>&lt;include&gt;</code>, <code>&lt;exclude&gt;</code> and
  5448. <code>&lt;patternset&gt;</code> elements.</p>
  5449. <h3>Parameters</h3>
  5450. <table border="1" cellpadding="2" cellspacing="0">
  5451. <tr>
  5452. <td valign="top"><b>Attribute</b></td>
  5453. <td valign="top"><b>Description</b></td>
  5454. <td align="center" valign="top"><b>Required</b></td>
  5455. </tr>
  5456. <tr>
  5457. <td valign="top">cabfile</td>
  5458. <td valign="top">the name of the cab file to create.</td>
  5459. <td valign="top" align="center">Yes</td>
  5460. </tr>
  5461. <tr>
  5462. <td valign="top">basedir</td>
  5463. <td valign="top">the directory to start archiving files from.</td>
  5464. <td valign="top" align="center">Yes</td>
  5465. </tr>
  5466. <tr>
  5467. <td valign="top">verbose</td>
  5468. <td valign="top">set to &quot;yes&quot; if you want to see the output from
  5469. the cabarc tool. defaults to &quot;no&quot;.</td>
  5470. <td valign="top" align="center">No</td>
  5471. </tr>
  5472. <tr>
  5473. <td valign="top">compress</td>
  5474. <td valign="top">set to &quot;no&quot; to store files without compressing.
  5475. defaults to &quot;yes&quot;.</td>
  5476. <td valign="top" align="center">No</td>
  5477. </tr>
  5478. <tr>
  5479. <td valign="top">options</td>
  5480. <td valign="top">use to set additional command-line options for
  5481. the cabarc tool. should not normally be necessary.</td>
  5482. <td valign="top" align="center">No</td>
  5483. </tr>
  5484. <tr>
  5485. <td valign="top">includes</td>
  5486. <td valign="top">comma separated list of patterns of files that
  5487. must be included. All files are included when omitted.</td>
  5488. <td valign="top" align="center">No</td>
  5489. </tr>
  5490. <tr>
  5491. <td valign="top">includesfile</td>
  5492. <td valign="top">the name of a file. Each line of this file is
  5493. taken to be an include pattern</td>
  5494. <td valign="top" align="center">No</td>
  5495. </tr>
  5496. <tr>
  5497. <td valign="top">excludes</td>
  5498. <td valign="top">comma separated list of patterns of files that
  5499. must be excluded. No files (except default excludes) are excluded
  5500. when omitted.</td>
  5501. <td valign="top" align="center">No</td>
  5502. </tr>
  5503. <tr>
  5504. <td valign="top">excludesfile</td>
  5505. <td valign="top">the name of a file. Each line of this file is
  5506. taken to be an exclude pattern</td>
  5507. <td valign="top" align="center">No</td>
  5508. </tr>
  5509. <tr>
  5510. <td valign="top">defaultexcludes</td>
  5511. <td valign="top">indicates whether default excludes should be used
  5512. or not (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when omitted.</td>
  5513. <td valign="top" align="center">No</td>
  5514. </tr>
  5515. </table>
  5516. <h3>Examples</h3>
  5517. <blockquote><pre>
  5518. &lt;cab cabfile=&quot;${dist}/manual.cab&quot;
  5519. basedir=&quot;htdocs/manual&quot;
  5520. /&gt;
  5521. </pre></blockquote>
  5522. <p>cabs all files in the htdocs/manual directory into a file called
  5523. manual.cab in the ${dist} directory.</p>
  5524. <blockquote><pre>
  5525. &lt;cab cabfile=&quot;${dist}/manual.cab&quot;
  5526. basedir=&quot;htdocs/manual&quot;
  5527. excludes=&quot;mydocs/**, **/todo.html&quot;
  5528. /&gt;
  5529. </pre></blockquote>
  5530. <p>cabs all files in the htdocs/manual directory into a file called
  5531. manual.cab in the ${dist} directory. Files in the directory mydocs,
  5532. or files with the name todo.html are excluded.</p>
  5533. <blockquote><pre>
  5534. &lt;cab cabfile=&quot;${dist}/manual.cab&quot;
  5535. basedir=&quot;htdocs/manual&quot;
  5536. includes=&quot;api/**/*.html&quot;
  5537. excludes=&quot;**/todo.html&quot;
  5538. verbose=&quot;yes&quot;
  5539. /&gt;
  5540. </pre></blockquote>
  5541. <p>cab all files in the htdocs/manual directory into a file called
  5542. manual.cab in the ${dist} directory. Only html files under the
  5543. directory api are archived, and files with the name todo.html are
  5544. excluded. Output from the cabarc tool is displayed in the build
  5545. output.</p>
  5546. <hr>
  5547. <h2><a name="ftp">FTP</a></h2>
  5548. <h3>Description</h3>
  5549. <p><b>Note:</b> The ftp-task uses the NetComponents-Package which you will need to download from
  5550. <a href="http://www.savarese.org">http://www.savarese.org</a> and add to your classpath.</p>
  5551. <p>The ftp task implements a basic FTP client that can send, receive,
  5552. list, and delete files. See below for descriptions and examples of how
  5553. to perform each task.</p>
  5554. <p>The ftp task makes no attempt to determine what file system syntax is
  5555. required by the remote server, and defaults to Unix standards.
  5556. <i>remotedir</i> must be specified in the exact syntax required by the ftp
  5557. server. If the usual Unix conventions are not supported by the server,
  5558. <i>separator</i> can be used to set the file separator that should be used
  5559. instead.</p>
  5560. <p>See the section on <a href="#directorybasedtasks">directory based
  5561. tasks</a>, on how the inclusion/exclusion of files works, and how to
  5562. write patterns.</p>
  5563. <h3>Parameters</h3>
  5564. <table border="1" cellpadding="2" cellspacing="0">
  5565. <tr>
  5566. <td valign="top"><b>Attribute</b></td>
  5567. <td valign="top"><b>Description</b></td>
  5568. <td align="center" valign="top"><b>Required</b></td>
  5569. </tr>
  5570. <tr>
  5571. <td valign="top">server</td>
  5572. <td valign="top">the address of the remote ftp server.</td>
  5573. <td valign="top" align="center">Yes</td>
  5574. </tr>
  5575. <tr>
  5576. <td valign="top">port</td>
  5577. <td valign="top">the port number of the remote ftp server.
  5578. Defaults to port 21.</td>
  5579. <td valign="top" align="center">No</td>
  5580. </tr>
  5581. <tr>
  5582. <td valign="top">userid</td>
  5583. <td valign="top">the login id to use on the ftp server.</td>
  5584. <td valign="top" align="center">Yes</td>
  5585. </tr>
  5586. <tr>
  5587. <td valign="top">password</td>
  5588. <td valign="top">the login password to use on the ftp server.</td>
  5589. <td valign="top" align="center">Yes</td>
  5590. </tr>
  5591. <tr>
  5592. <td valign="top">remotedir</td>
  5593. <td valign="top">the directory to which to upload files on the
  5594. ftp server.</td>
  5595. <td valign="top" align="center">No</td>
  5596. </tr>
  5597. <tr>
  5598. <td valign="top">action</td>
  5599. <td valign="top">the ftp action to perform, defaulting to &quot;send&quot;.
  5600. Currently supports&quot;put&quot;, &quot;get&quot;,
  5601. &quot;del&quot;, and &quot;list&quot;.</td>
  5602. <td valign="top" align="center">No</td>
  5603. </tr>
  5604. <tr>
  5605. <td valign="top">binary</td>
  5606. <td valign="top">selects binary-mode (&quot;yes&quot;) or text-mode
  5607. (&quot;no&quot;) transfers.
  5608. Defaults to &quot;yes&quot;</td>
  5609. <td valign="top" align="center">No</td>
  5610. </tr>
  5611. <tr>
  5612. <td valign="top">passive</td>
  5613. <td valign="top">selects passive-mode (&quot;yes&quot;) transfers.
  5614. Defaults to &quot;no&quot;</td>
  5615. <td valign="top" align="center">No</td>
  5616. </tr>
  5617. <tr>
  5618. <td valign="top">verbose</td>
  5619. <td valign="top">displays information on each file transferred if set
  5620. to &quot;yes&quot;. Defaults to &quot;no&quot;.</td>
  5621. <td valign="top" align="center">No</td>
  5622. </tr>
  5623. <tr>
  5624. <td valign="top">depends</td>
  5625. <td valign="top">transfers only new or changed files if set to
  5626. &quot;yes&quot;. Defaults to &quot;no&quot;.</td>
  5627. <td valign="top" align="center">No</td>
  5628. </tr>
  5629. <tr>
  5630. <td valign="top">newer</td>
  5631. <td valign="top">a synonym for <i>depends</i>.</td>
  5632. <td valign="top" align="center">No</td>
  5633. </tr>
  5634. <tr>
  5635. <td valign="top">separator</td>
  5636. <td valign="top">sets the file separator used on the ftp server.
  5637. Defaults to &quot;/&quot;.</td>
  5638. <td valign="top" align="center">No</td>
  5639. </tr>
  5640. <tr>
  5641. <td valign="top">listing</td>
  5642. <td valign="top">the file to write results of the &quot;list&quot; action.
  5643. Required for the &quot;list&quot; action, ignored otherwise.</td>
  5644. <td valign="top" align="center">No</td>
  5645. </tr>
  5646. </table>
  5647. <h3>Sending Files</h3>
  5648. <p>The easiest way to describe how to send files is with a couple of examples:</p>
  5649. <pre>
  5650. &lt;ftp server=&quot;ftp.apache.org&quot;
  5651. userid=&quot;anonymous&quot;
  5652. password=&quot;me@myorg.com&quot;&gt;
  5653. &lt;fileset dir=&quot;htdocs/manual&quot;/&gt;
  5654. &lt;/ftp&gt;
  5655. </pre>
  5656. <p>Logs in to <code>ftp.apache.org</code> as <code>anonymous</code> and
  5657. uploads all files in the <code>htdocs/manual</code> directory
  5658. to the default directory for that user.</p>
  5659. <pre> &lt;ftp server=&quot;ftp.apache.org&quot;
  5660. remotedir=&quot;incoming&quot;
  5661. userid=&quot;anonymous&quot;
  5662. password=&quot;me@myorg.com&quot;
  5663. depends=&quot;yes&quot;
  5664. &gt;
  5665. &lt;fileset dir=&quot;htdocs/manual&quot;/&gt;
  5666. &lt;/ftp&gt;</pre>
  5667. <p>Logs in to <code>ftp.apache.org</code> as <code>anonymous</code> and
  5668. uploads all new or changed files in the <code>htdocs/manual</code> directory
  5669. to the <code>incoming</code> directory relative to the default directory
  5670. for <code>anonymous</code>.</p>
  5671. <pre> &lt;ftp server=&quot;ftp.apache.org&quot;
  5672. port=&quot;2121&quot;
  5673. remotedir=&quot;/pub/incoming&quot;
  5674. userid=&quot;coder&quot;
  5675. password=&quot;java1&quot;
  5676. depends=&quot;yes&quot;
  5677. binary=&quot;no&quot;
  5678. &gt;
  5679. &lt;fileset dir=&quot;htdocs/manual&quot;&gt;
  5680. &lt;include name=&quot;**/*.html&quot;/&gt;
  5681. &lt;/fileset&gt;
  5682. &lt;/ftp&gt;</pre>
  5683. <p>Logs in to <code>ftp.apache.org</code> at port <code>2121</code> as
  5684. <code>coder</code> with password <code>java1</code> and uploads all new or
  5685. changed HTML files in the <code>htdocs/manual</code> directory to the
  5686. <code>/pub/incoming</code> directory. The files are transferred in text mode. Passive mode has been switched on to send files from behind a firewall.</p>
  5687. <pre> &lt;ftp server=&quot;ftp.nt.org&quot;
  5688. remotedir=&quot;c:\uploads&quot;
  5689. userid=&quot;coder&quot;
  5690. password=&quot;java1&quot;
  5691. separator=&quot;\&quot;
  5692. verbose=&quot;yes&quot;</pre>
  5693. <PRE>
  5694. &gt;
  5695. &lt;fileset dir=&quot;htdocs/manual&quot;&gt;
  5696. &lt;include name=&quot;**/*.html&quot;/&gt;
  5697. &lt;/fileset&gt;
  5698. &lt;/ftp&gt;</PRE><p>Logs in to the Windows-based <code>ftp.nt.org</code> as
  5699. <code>coder</code> with password <code>java1</code> and uploads all
  5700. HTML files in the <code>htdocs/manual</code> directory to the
  5701. <code>c:\uploads</code> directory. Progress messages are displayed as each
  5702. file is uploaded.</p>
  5703. <h3>Getting Files</h3>
  5704. <p>Getting files from an FTP server works pretty much the same way as
  5705. sending them does. The only difference is that the nested filesets
  5706. use the remotedir attribute as the base directory for the files on the
  5707. FTP server, and the dir attribute as the local directory to put the files
  5708. into. The file structure from the FTP site is preserved on the local machine.</p>
  5709. <pre>
  5710. &lt;ftp action=&quot;get&quot;
  5711. server=&quot;ftp.apache.org&quot;
  5712. userid=&quot;anonymous&quot;
  5713. password=&quot;me@myorg.com&quot;&gt;
  5714. &lt;fileset dir=&quot;htdocs/manual&quot; &gt;
  5715. &lt;include name=&quot;**/*.html&quot;/&gt;
  5716. &lt;/fileset&gt;
  5717. &lt;/ftp&gt;
  5718. </pre>
  5719. <p>Logs in to <code>ftp.apache.org</code> as <code>anonymous</code> and
  5720. recursively downloads all .html files from default directory for that user
  5721. into the <code>htdocs/manual</code> directory on the local machine.</p>
  5722. <h3>Deleting Files</h3>
  5723. As you've probably guessed by now, you use nested fileset elements to
  5724. select the files to delete from the remote FTP server. Again, the
  5725. filesets are relative to the remote directory, not a local directory. In
  5726. fact, the dir attribute of the fileset is ignored completely.
  5727. <pre>
  5728. &lt;ftp action=&quot;del&quot;
  5729. server=&quot;ftp.apache.org&quot;
  5730. userid=&quot;anonymous&quot;
  5731. password=&quot;me@myorg.com&quot; &gt;
  5732. &lt;fileset&gt;
  5733. &lt;include name=&quot;**/*.tmp&quot;/&gt;
  5734. &lt;/fileset&gt;
  5735. &lt;/ftp&gt;
  5736. </pre>
  5737. <p>Logs in to <code>ftp.apache.org</code> as <code>anonymous</code> and
  5738. tries to delete all *.tmp files from the default directory for that user.
  5739. If you don't have permission to delete a file, a BuildException is thrown.</p>
  5740. <h3>Listing Files</h3>
  5741. <pre>
  5742. &lt;ftp action=&quot;list&quot;
  5743. server=&quot;ftp.apache.org&quot;
  5744. userid=quot;anonymous&quot;
  5745. password=&quot;me@myorg.com&quot;
  5746. listing=&quot;data/ftp.listing&quot; &gt;
  5747. &lt;fileset&gt;
  5748. &lt;include name=&quot;**&quot;/&gt;
  5749. &lt;/fileset&gt;
  5750. &lt;/ftp&gt;
  5751. </pre>
  5752. <p>This provides a file listing in <code>data/ftp.listing</code> of all the files on
  5753. the FTP server relative to the default directory of the <code>anonymous</code>
  5754. user. The listing is in whatever format the FTP server normally lists files.</p>
  5755. <hr>
  5756. <h2><a name="netrexxc">NetRexxC</a></h2>
  5757. <h3>Description</h3>
  5758. <p>Compiles a <a href="http://www2.hursley.ibm.com/netrexx">NetRexx</a>
  5759. source tree within the running (Ant) VM.</p>
  5760. <p>The source and destination directory will be recursively scanned for
  5761. NetRexx source files to compile. Only NetRexx files that have no corresponding
  5762. class file or where the class file is older than the java file will be compiled.</p>
  5763. <p>Files in the source tree are copied to the destination directory,
  5764. allowing support files to be located properly in the classpath. The source
  5765. files are copied because the NetRexx compiler cannot produce class files in a
  5766. specific directory via parameters</p>
  5767. <p>The directory structure of the source tree should follow the package
  5768. hierarchy.</p>
  5769. <p>It is possible to refine the set of files that are being compiled/copied.
  5770. This can be done with the <i>includes</i>, <i>includesfile</i>, <i>excludes</i>, <i>excludesfile</i> and
  5771. <i>defaultexcludes</i> attributes. With the <i>includes</i> or <i>includesfile</i> attribute you
  5772. specify the files you want to have included by using patterns. The
  5773. <i>exclude</i> or <i>excludesfile</i> attribute is used to specify the files you want to have
  5774. excluded. This is also done with patterns. And finally with the
  5775. <i>defaultexcludes</i> attribute, you can specify whether you
  5776. want to use default exclusions or not. See the section on <a
  5777. href="#directorybasedtasks">directory based tasks</a>, on how the
  5778. inclusion/exclusion of files works, and how to write patterns.</p>
  5779. <p>This task forms an implicit <a href="#fileset">FileSet</a> and
  5780. supports all attributes of <code>&lt;fileset&gt;</code>
  5781. (<code>dir</code> becomes <code>srcdir</code>) as well as the nested
  5782. <code>&lt;include&gt;</code>, <code>&lt;exclude&gt;</code> and
  5783. <code>&lt;patternset&gt;</code> elements.</p>
  5784. <h3>Parameters</h3>
  5785. <table border="1" cellpadding="2" cellspacing="0">
  5786. <tr>
  5787. <td valign="top"><b>Attribute</b></td>
  5788. <td valign="top"><b>Description</b></td>
  5789. <td align="center" valign="top"><b>Required</b></td>
  5790. </tr>
  5791. <tr>
  5792. <td valign="top">binary</td>
  5793. <td valign="top">Whether literals are treated as the java binary
  5794. type rather than the NetRexx types</td>
  5795. <td valign="top" align="center">No</td>
  5796. </tr>
  5797. <tr>
  5798. <td valign="top">classpath</td>
  5799. <td valign="top">The classpath to use during compilation</td>
  5800. <td valign="top" align="center">No</td>
  5801. </tr>
  5802. <tr>
  5803. <td valign="top">comments</td>
  5804. <td valign="top">Whether comments are passed through to the
  5805. generated java source</td>
  5806. <td valign="top" align="center">No</td>
  5807. </tr>
  5808. <tr>
  5809. <td valign="top">compact</td>
  5810. <td valign="top">Whether error messages come out in compact or
  5811. verbose format</td>
  5812. <td valign="top" align="center">No</td>
  5813. </tr>
  5814. <tr>
  5815. <td valign="top">compile</td>
  5816. <td valign="top">Whether the NetRexx compiler should compile the
  5817. generated java code</td>
  5818. <td valign="top" align="center">No</td>
  5819. </tr>
  5820. <tr>
  5821. <td valign="top">console</td>
  5822. <td valign="top">Whether or not messages should be displayed on the
  5823. 'console'</td>
  5824. <td valign="top" align="center">No</td>
  5825. </tr>
  5826. <tr>
  5827. <td valign="top">crossref</td>
  5828. <td valign="top">Whether variable cross references are generated</td>
  5829. <td valign="top" align="center">No</td>
  5830. </tr>
  5831. <tr>
  5832. <td valign="top">decimal</td>
  5833. <td valign="top">Whether decimal arithmetic should be used for the
  5834. NetRexx code</td>
  5835. <td valign="top" align="center">No</td>
  5836. </tr>
  5837. <tr>
  5838. <td valign="top">defaultexcludes</td>
  5839. <td valign="top">indicates whether default excludes should be used or not
  5840. (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when
  5841. omitted.</td>
  5842. <td valign="top" align="center">No</td>
  5843. </tr>
  5844. <tr>
  5845. <td valign="top">destDir</td>
  5846. <td valign="top">the destination directory into which the NetRexx
  5847. source files should be copied and then compiled</td>
  5848. <td valign="top" align="center">Yes</td>
  5849. </tr>
  5850. <tr>
  5851. <td valign="top">diag</td>
  5852. <td valign="top">Whether diagnostic information about the compile is
  5853. generated</td>
  5854. <td valign="top" align="center">No</td>
  5855. </tr>
  5856. <tr>
  5857. <td valign="top">excludes</td>
  5858. <td valign="top">comma separated list of patterns of files that must be
  5859. excluded. No files (except default excludes) are excluded when
  5860. omitted.</td>
  5861. <td valign="top" align="center">No</td>
  5862. </tr>
  5863. <tr>
  5864. <td valign="top">excludesfile</td>
  5865. <td valign="top">the name of a file. Each line of this file is
  5866. taken to be an exclude pattern</td>
  5867. <td valign="top" align="center">No</td>
  5868. </tr>
  5869. <tr>
  5870. <td valign="top">explicit</td>
  5871. <td valign="top">Whether variables must be declared explicitly
  5872. before use</td>
  5873. <td valign="top" align="center">No</td>
  5874. </tr>
  5875. <tr>
  5876. <td valign="top">format</td>
  5877. <td valign="top">Whether the generated java code is formatted nicely
  5878. or left to match NetRexx line numbers for call stack debugging</td>
  5879. <td valign="top" align="center">No</td>
  5880. </tr>
  5881. <tr>
  5882. <td valign="top">includes</td>
  5883. <td valign="top">comma separated list of patterns of files that must be
  5884. included. All files are included when omitted.</td>
  5885. <td valign="top" align="center">No</td>
  5886. </tr>
  5887. <tr>
  5888. <td valign="top">includesfile</td>
  5889. <td valign="top">the name of a file. Each line of this file is
  5890. taken to be an include pattern</td>
  5891. <td valign="top" align="center">No</td>
  5892. </tr>
  5893. <tr>
  5894. <td valign="top">java</td>
  5895. <td valign="top">Whether the generated java code is produced</td>
  5896. <td valign="top" align="center">No</td>
  5897. </tr>
  5898. <tr>
  5899. <td valign="top">keep</td>
  5900. <td valign="top">Sets whether the generated java source file should be kept
  5901. after compilation. The generated files will have an extension of
  5902. .java.keep, <b>not</b> .java</td>
  5903. <td valign="top" align="center">No</td>
  5904. </tr>
  5905. <tr>
  5906. <td valign="top">logo</td>
  5907. <td valign="top">Whether the compiler text logo is displayed when
  5908. compiling</td>
  5909. <td valign="top" align="center">No</td>
  5910. </tr>
  5911. <tr>
  5912. <td valign="top">replace</td>
  5913. <td valign="top">Whether the generated .java file should be replaced
  5914. when compiling</td>
  5915. <td valign="top" align="center">No</td>
  5916. </tr>
  5917. <tr>
  5918. <td valign="top">savelog</td>
  5919. <td valign="top">Whether the compiler messages will be written to
  5920. NetRexxC.log as well as to the console</td>
  5921. <td valign="top" align="center">No</td>
  5922. </tr>
  5923. <tr>
  5924. <td valign="top">sourcedir</td>
  5925. <td valign="top">Tells the NetRexx compiler to store the class files in the
  5926. same directory as the source files. The alternative is the working
  5927. directory</td>
  5928. <td valign="top" align="center">No</td>
  5929. </tr>
  5930. <tr>
  5931. <td valign="top">srcDir</td>
  5932. <td valign="top">Set the source dir to find the source Netrexx
  5933. files</td>
  5934. <td valign="top" align="center">Yes</td>
  5935. </tr>
  5936. <tr>
  5937. <td valign="top">strictargs</td>
  5938. <td valign="top">Tells the NetRexx compiler that method calls always
  5939. need parentheses, even if no arguments are needed, e.g.
  5940. <code>aStringVar.getBytes</code> vs.
  5941. <code>aStringVar.getBytes()</code></td>
  5942. <td valign="top" align="center">No</td>
  5943. </tr>
  5944. <tr>
  5945. <td valign="top">strictassign</td>
  5946. <td valign="top">Tells the NetRexx compile that assignments must
  5947. match exactly on type</td>
  5948. <td valign="top" align="center">No</td>
  5949. </tr>
  5950. <tr>
  5951. <td valign="top">strictcase</td>
  5952. <td valign="top">Specifies whether the NetRexx compiler should be
  5953. case sensitive or not</td>
  5954. <td valign="top" align="center">No</td>
  5955. </tr>
  5956. <tr>
  5957. <td valign="top">strictimport</td>
  5958. <td valign="top">Whether classes need to be imported explicitly using an
  5959. <code>import</code> statement. By default the NetRexx compiler will
  5960. import certain packages automatically</td>
  5961. <td valign="top" align="center">No</td>
  5962. </tr>
  5963. <tr>
  5964. <td valign="top">strictprops</td>
  5965. <td valign="top">Whether local properties need to be qualified
  5966. explicitly using <code>this</code></td>
  5967. <td valign="top" align="center">No</td>
  5968. </tr>
  5969. <tr>
  5970. <td valign="top">strictsignal</td>
  5971. <td valign="top">Whether the compiler should force catching of
  5972. exceptions by explicitly named types</td>
  5973. <td valign="top" align="center">No</td>
  5974. </tr>
  5975. <tr>
  5976. <td valign="top">symbols</td>
  5977. <td valign="top">Whether debug symbols should be generated into the
  5978. class file</td>
  5979. <td valign="top" align="center">No</td>
  5980. </tr>
  5981. <tr>
  5982. <td valign="top">time</td>
  5983. <td valign="top">Asks the NetRexx compiler to print compilation
  5984. times to the console</td>
  5985. <td valign="top" align="center">No</td>
  5986. </tr>
  5987. <tr>
  5988. <td valign="top">trace</td>
  5989. <td valign="top">Turns on or off tracing and directs the resultant
  5990. trace output</td>
  5991. <td valign="top" align="center">No</td>
  5992. </tr>
  5993. <tr>
  5994. <td valign="top">utf8</td>
  5995. <td valign="top">Tells the NetRexx compiler that the source is in UTF8</td>
  5996. <td valign="top" align="center">No</td>
  5997. </tr>
  5998. <tr>
  5999. <td valign="top">verbose</td>
  6000. <td valign="top">Whether lots of warnings and error messages should
  6001. be generated</td>
  6002. <td valign="top" align="center">Yes</td>
  6003. </tr>
  6004. </table>
  6005. <h3>Examples</h3>
  6006. <blockquote>
  6007. <p><code>&lt;netrexxc srcDir=&quot;/source/project&quot;
  6008. includes=&quot;vnr/util/*&quot;
  6009. destDir=&quot;/source/project/build&quot;
  6010. classpath=&quot;/source/project2/proj.jar&quot;
  6011. comments=&quot;true&quot;
  6012. crossref=&quot;false&quot; replace=&quot;true&quot;
  6013. keep=&quot;true&quot;/&gt;</code>
  6014. </p>
  6015. </blockquote>
  6016. <hr>
  6017. <h2><a name="renameexts">RenameExtensions</a></h2>
  6018. <h3><i>Deprecated</i></h3>
  6019. <p><i>This task has been deprecated. Use the <a href="#move">move</a>
  6020. task with a <a href="#glob-mapper">glob mapper</a> instead.</i></p>
  6021. <h3>Description</h3>
  6022. <p>Renames files in the <code>srcDir</code> directory ending with the
  6023. <code>fromExtension</code> string so that they end with the
  6024. <code>toExtension</code> string. Files are only replaced if
  6025. <code>replace</code> is true
  6026. </p>
  6027. <p>See the section on
  6028. <a href="#directorybasedtasks">directory based tasks</a>, on how the
  6029. inclusion/exclusion of files works, and how to write patterns.
  6030. This task forms an implicit <a href="#fileset">FileSet</a> and
  6031. supports all attributes of <code>&lt;fileset&gt;</code>
  6032. (<code>dir</code> becomes <code>srcDir</code>) as well as the nested
  6033. <code>&lt;include&gt;</code>, <code>&lt;exclude&gt;</code> and
  6034. <code>&lt;patternset&gt;</code> elements.</p>
  6035. <h3>Parameters</h3>
  6036. <table border="1" cellpadding="2" cellspacing="0">
  6037. <tr>
  6038. <td valign="top"><b>Attribute</b></td>
  6039. <td valign="top"><b>Description</b></td>
  6040. <td align="center" valign="top"><b>Required</b></td>
  6041. </tr>
  6042. <tr>
  6043. <td valign="top">defaultexcludes</td>
  6044. <td valign="top">indicates whether default excludes should be used or not
  6045. (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when
  6046. omitted.</td>
  6047. <td valign="top" align="center">No</td>
  6048. </tr>
  6049. <tr>
  6050. <td valign="top">excludes</td>
  6051. <td valign="top">comma separated list of patterns of files that must be
  6052. excluded. No files (except default excludes) are excluded when
  6053. omitted.</td>
  6054. <td valign="top" align="center">No</td>
  6055. </tr>
  6056. <tr>
  6057. <td valign="top">excludesfile</td>
  6058. <td valign="top">the name of a file. Each line of this file is
  6059. taken to be an exclude pattern</td>
  6060. <td valign="top" align="center">No</td>
  6061. </tr>
  6062. <tr>
  6063. <td valign="top">fromExtention</td>
  6064. <td valign="top">The string that files must end in to be renamed</td>
  6065. <td valign="top" align="center">Yes</td>
  6066. </tr>
  6067. <tr>
  6068. <td valign="top">includes</td>
  6069. <td valign="top">comma separated list of patterns of files that must be
  6070. included. All files are included when omitted.</td>
  6071. <td valign="top" align="center">No</td>
  6072. </tr>
  6073. <tr>
  6074. <td valign="top">includesfile</td>
  6075. <td valign="top">the name of a file. Each line of this file is
  6076. taken to be an include pattern</td>
  6077. <td valign="top" align="center">No</td>
  6078. </tr>
  6079. <tr>
  6080. <td valign="top">replace</td>
  6081. <td valign="top">Whether the file being renamed to should be
  6082. replaced if it already exists</td>
  6083. <td valign="top" align="center">No</td>
  6084. </tr>
  6085. <tr>
  6086. <td valign="top">srcDir</td>
  6087. <td valign="top">The starting directory for files to search in</td>
  6088. <td valign="top" align="center">Yes</td>
  6089. </tr>
  6090. <tr>
  6091. <td valign="top">toExtension</td>
  6092. <td valign="top">The string that renamed files will end with on
  6093. completion</td>
  6094. <td valign="top" align="center">Yes</td>
  6095. </tr>
  6096. </table>
  6097. <h3>Examples</h3>
  6098. <blockquote>
  6099. <p><code>&lt;renameext srcDir=&quot;/source/project1&quot;
  6100. includes=&quot;**&quot;
  6101. excludes=&quot;**/samples/*&quot;
  6102. fromExtension=&quot;.java.keep&quot;
  6103. toExtension=&quot;.java&quot;
  6104. replace=&quot;true&quot;/&gt;
  6105. </code>
  6106. </p>
  6107. </blockquote>
  6108. <hr>
  6109. <h2><a name="script">Script</a></h2>
  6110. <h3>Description</h3>
  6111. <p>Execute a script in a
  6112. <a href="http://oss.software.ibm.com/developerworks/opensource/bsf/">BSF</a> supported language.
  6113. <p>All items (tasks, targets, etc) of the running project are
  6114. accessible from the script, using either their <code>name</code> or
  6115. <code>id</code> attributes.</p>
  6116. <p>Scripts can do almost anything a task written in Java could do.</p>
  6117. <h3>Parameters</h3>
  6118. <table border="1" cellpadding="2" cellspacing="0">
  6119. <tr>
  6120. <td valign="top"><b>Attribute</b></td>
  6121. <td valign="top"><b>Description</b></td>
  6122. <td align="center" valign="top"><b>Required</b></td>
  6123. </tr>
  6124. <tr>
  6125. <td valign="top">language</td>
  6126. <td valign="top">The programming language the script is written in.
  6127. Must be a supported BSF language</td>
  6128. <td valign="top" align="center">No</td>
  6129. </tr>
  6130. <tr>
  6131. <td valign="top">src</td>
  6132. <td valign="top">The location of the script as a file, if not inline</td>
  6133. <td valign="top" align="center">No</td>
  6134. </tr>
  6135. </table>
  6136. <h3>Examples</h3>
  6137. <blockquote><pre>
  6138. &lt;project name=&quot;squares&quot; default=&quot;main&quot; basedir=&quot;.&quot;&gt;
  6139. &lt;target name=&quot;setup&quot;&gt;
  6140. &lt;script language=&quot;javascript&quot;&gt; &lt;![CDATA[
  6141. for (i=1; i&lt;=10; i++) {
  6142. echo = squares.createTask(&quot;echo&quot;);
  6143. main.addTask(echo);
  6144. echo.setMessage(i*i);
  6145. }
  6146. ]]&gt; &lt;/script&gt;
  6147. &lt;/target&gt;
  6148. &lt;target name=&quot;main&quot; depends=&quot;setup&quot;/&gt;
  6149. &lt;/project&gt;
  6150. </pre></blockquote>
  6151. <p>generates</p>
  6152. <blockquote><pre>
  6153. setup:
  6154. main:
  6155. 1
  6156. 4
  6157. 9
  6158. 16
  6159. 25
  6160. 36
  6161. 49
  6162. 64
  6163. 81
  6164. 100
  6165. BUILD SUCCESSFUL
  6166. </pre></blockquote>
  6167. <p>Another example, using <a href="#references">references by id</a>
  6168. and two different scripting languages:</p>
  6169. <blockquote><pre>
  6170. &lt;project name=&quot;testscript&quot; default=&quot;main&quot;&gt;
  6171. &lt;target name=&quot;sub&quot;&gt;
  6172. &lt;echo id=&quot;theEcho&quot;/&gt;
  6173. &lt;/target&gt;
  6174. &lt;target name=&quot;sub1&quot;&gt;
  6175. &lt;script language=&quot;netrexx&quot;&gt;&lt;![CDATA[
  6176. theEcho.setMessage(&quot;In sub1&quot;)
  6177. sub.execute
  6178. ]]&gt;&lt;/script&gt;
  6179. &lt;/target&gt;
  6180. &lt;target name=&quot;sub2&quot;&gt;
  6181. &lt;script language=&quot;javascript&quot;&gt;&lt;![CDATA[
  6182. theEcho.setMessage(&quot;In sub2&quot;);
  6183. sub.execute();
  6184. ]]&gt;&lt;/script&gt;
  6185. &lt;/target&gt;
  6186. &lt;target name=&quot;main&quot; depends=&quot;sub1,sub2&quot;/&gt;
  6187. &lt;/project&gt;
  6188. </pre></blockquote>
  6189. <p>generates</p>
  6190. <blockquote><pre>
  6191. sub1:
  6192. In sub1
  6193. sub2:
  6194. In sub2
  6195. main:
  6196. BUILD SUCCESSFUL
  6197. </pre></blockquote>
  6198. <hr>
  6199. <h2><a name="sound">Sound</a></h2>
  6200. <h3>Description</h3>
  6201. <p>Plays a sound-file at the end of the build, according to whether
  6202. the build failed or succeeded. You can specify either a specific
  6203. sound-file to play, or, if a directory is specified, the
  6204. <code>&lt;sound&gt;</code> task will randomly select a file to play.
  6205. Note: At this point, the random selection is based on all the files
  6206. in the directory, not just those ending in appropriate suffixes
  6207. for sound-files, so be sure you only have sound-files in the
  6208. directory you specify.
  6209. <h3>Parameters</h3>
  6210. <table border="1" cellpadding="2" cellspacing="0">
  6211. <tr>
  6212. <td valign="top"><b>Attribute</b></td>
  6213. <td valign="top"><b>Description</b></td>
  6214. <td align="center" valign="top"><b>Required</b></td>
  6215. </tr>
  6216. <tr>
  6217. <td valign="top">loops</td>
  6218. <td valign="top">the number of extra times to play the sound-file;
  6219. default is <code>0</code>.
  6220. </td>
  6221. <td valign="top" align="center">No</td>
  6222. </tr>
  6223. <tr>
  6224. <td valign="top">duration</td>
  6225. <td valign="top">the amount of time (in milliseconds) to play
  6226. the sound-file.
  6227. </td>
  6228. <td valign="top" align="center">No</td>
  6229. </tr>
  6230. </table>
  6231. <p>
  6232. To specify the sound-files or the sound-file directories, use the
  6233. nested <code>&lt;success&gt;</code> and <code>&lt;fail&gt;</code>
  6234. elements:
  6235. <blockquote>
  6236. <pre>
  6237. &lt;success&gt; the path to a sound-file directory, or the name of a
  6238. specific sound-file, to be played if the build succeeded.
  6239. &lt;fail&gt; the path to a sound-file directory, or the name of a
  6240. specific sound-file, to be played if the build succeeded.
  6241. </pre>
  6242. </blockquote>
  6243. <h3>Examples</h3>
  6244. <blockquote>
  6245. <pre>
  6246. &lt;target name="fun" if="fun" unless="fun.done"&gt;
  6247. &lt;sound loops="2"&gt;
  6248. &lt;success source="${user.home}/sounds/bell.wav"/&gt;
  6249. &lt;fail source="${user.home}/sounds/ohno.wav"/&gt;
  6250. &lt;/sound&gt;
  6251. &lt;property name="fun.done" value="true"/&gt;
  6252. &lt;/target&gt;
  6253. </pre>
  6254. </blockquote>
  6255. plays the <code>bell.wav</code> sound-file if the build succeeded, or
  6256. the <code>ohno.wav</code> sound-file if the build failed, three times,
  6257. if the <code>fun</code> property is set to <code>true</code>.
  6258. If the target
  6259. is a dependency of an &quot;initialization&quot; target that other
  6260. targets depend on, the
  6261. <code>fun.done</code> property prevents the target from being executed
  6262. more than once.
  6263. <blockquote>
  6264. <pre>
  6265. &lt;target name="fun" if="fun" unless="fun.done"&gt;
  6266. &lt;sound>
  6267. &lt;success source="//intranet/sounds/success"/&gt;
  6268. &lt;fail source="//intranet/sounds/failure"/&gt;
  6269. &lt;/sound&gt;
  6270. &lt;property name="fun.done" value="true"/&gt;
  6271. &lt;/target&gt;
  6272. </pre>
  6273. </blockquote>
  6274. randomly selects a sound-file to play when the build succeeds or fails.
  6275. <hr>
  6276. <h2><a name="telnet">Telnet</a></h2>
  6277. <h3>Description</h3>
  6278. Task to automate a remote telnet session. The task uses nested &lt;read&gt; to indicate strings to wait for, and &lt;write&gt; tags to specify text to send.
  6279. <p>If you do specify a userid and password, the system will assume a common unix prompt to wait on. This behavior can be easily over-ridden.</p>
  6280. <h3>Parameters</h3>
  6281. <table border="1" cellpadding="2" cellspacing="0">
  6282. <tr>
  6283. <th>Attribute</th>
  6284. <th>Values</th>
  6285. <th>Required</th>
  6286. </tr>
  6287. <tr>
  6288. <td>userid</td>
  6289. <td>the login id to use on the telnet server.</td>
  6290. <td>No</td>
  6291. </tr>
  6292. <tr>
  6293. <td>password</td>
  6294. <td>the login password to use on the telnet server.</td>
  6295. <td>No</td>
  6296. </tr>
  6297. <tr>
  6298. <td>server</td>
  6299. <td>the address of the remote telnet server.</td>
  6300. <td>Yes</td>
  6301. </tr>
  6302. <tr>
  6303. <td>port</td>
  6304. <td>the port number of the remote telnet server. Defaults to port 23.</td>
  6305. <td>No</td>
  6306. </tr>
  6307. <tr>
  6308. <td>initialCR</td>
  6309. <td>send a cr after connecting ("yes"). Defaults to "no".</td>
  6310. <td>No</td>
  6311. </tr>
  6312. <tr>
  6313. <td>timeout</td>
  6314. <td>set a default timeout to wait for a response. Specified in seconds. Default is no timeout.</td>
  6315. <td>No</td>
  6316. </tr>
  6317. </table>
  6318. <h3>Examples</h3>
  6319. A simple example of connecting to a server and running a command. This assumes a prompt of "ogin:" for the userid, and a prompt of "assword:" for the password.
  6320. <blockquote><pre>
  6321. &lt;telnet userid=&quot;bob&quot; password=&quot;badpass&quot; server=&quot;localhost&quot;&gt;
  6322. &lt;read&gt;/home/bob&lt;/read&gt;
  6323. &lt;write&gt;ls&lt;/write&gt;
  6324. &lt;read string=&quot;/home/bob&quot;/&gt;
  6325. &lt;/telnet&gt;
  6326. </pre></blockquote>
  6327. This task can be rewritten as:
  6328. <blockquote><pre>
  6329. &lt;telnet server=&quot;localhost&quot;&gt;
  6330. &lt;read&gt;ogin:&lt;/read&gt;
  6331. &lt;write&gt;bob&lt;/write&gt;
  6332. &lt;read&gt;assword:&lt;/read&gt;
  6333. &lt;write&gt;badpass&lt;/write&gt;
  6334. &lt;read&gt;/home/bob&lt;/read&gt;
  6335. &lt;write&gt;ls&lt;/write&gt;
  6336. &lt;read&gt;/home/bob&lt;/read&gt;
  6337. &lt;/telnet&gt;
  6338. </pre></blockquote>
  6339. A timeout can be specified at the &lt;telnet&gt; level or at the &lt;read&gt; level. This will connect, issue a sleep command that is suppressed from displaying and wait 10 seconds before quitting.
  6340. <blockquote><pre>
  6341. &lt;telnet userid=&quot;bob&quot; password=&quot;badpass&quot; server=&quot;localhost&quot; timeout=&quot;20&quot;&gt;
  6342. &lt;read&gt;/home/bob&lt;/read&gt;
  6343. &lt;write echo=&quot;false&quot;&gt;sleep 15&lt;/write&gt;
  6344. &lt;read timeout=&quot;10&quot;&gt;/home/bob&lt;/read&gt;
  6345. &lt;/telnet&gt;
  6346. </pre></blockquote>
  6347. The task can be used with other ports as well:
  6348. <blockquote><pre>
  6349. &lt;telnet port=&quot;80&quot; server=&quot;localhost&quot; timeout=&quot;20&quot;&gt;
  6350. &lt;read/&gt;
  6351. &lt;write&gt;GET / http/0.9&lt;/write&gt;
  6352. &lt;write/&gt;
  6353. &lt;read timeout=&quot;10&quot;&gt;&amp;lt;/HTML&amp;gt;&lt;/read&gt;
  6354. &lt;/telnet&gt;
  6355. </pre></blockquote>
  6356. <hr>
  6357. <h2><a name="vssget">VssGet</a></h2>
  6358. <h3>Description</h3>
  6359. Task to perform GET commands to Microsoft Visual Source Safe.
  6360. <p>If you specify two or more attributes from version, date and
  6361. label only one will be used in the order version, date, label.</p>
  6362. <h3>Parameters</h3>
  6363. <table border="1" cellpadding="2" cellspacing="0">
  6364. <tr>
  6365. <th>Attribute</th>
  6366. <th>Values</th>
  6367. <th>Required</th>
  6368. </tr>
  6369. <tr>
  6370. <td>login</td>
  6371. <td>username,password</td>
  6372. <td>No</td>
  6373. </tr>
  6374. <tr>
  6375. <td>vsspath</td>
  6376. <td>SourceSafe path</td>
  6377. <td>Yes</td>
  6378. </tr>
  6379. <tr>
  6380. <td>localpath</td>
  6381. <td>Override the working directory and get to the specified path</td>
  6382. <td>No</td>
  6383. </tr>
  6384. <tr>
  6385. <td>writable</td>
  6386. <td>true or false</td>
  6387. <td>No</td>
  6388. </tr>
  6389. <tr>
  6390. <td>recursive</td>
  6391. <td>true or false</td>
  6392. <td>No</td>
  6393. </tr>
  6394. <tr>
  6395. <td>version</td>
  6396. <td>a version number to get</td>
  6397. <td>No</td>
  6398. </tr>
  6399. <tr>
  6400. <td>date</td>
  6401. <td>a date stamp to get at</td>
  6402. <td>No</td>
  6403. </tr>
  6404. <tr>
  6405. <td>label</td>
  6406. <td>a label to get for</td>
  6407. <td>No</td>
  6408. </tr>
  6409. <tr>
  6410. <td>ssdir</td>
  6411. <td>directory where <code>ss.exe</code> resides. By default the
  6412. task expects it to be in the PATH.</td>
  6413. <td>No</td>
  6414. </tr>
  6415. </table>
  6416. <p>Note that only one of version, date or label should be specified</p>
  6417. <h3>Examples</h3>
  6418. <blockquote>
  6419. <pre>
  6420. &lt;vssget localPath=&quot;C:\mysrc\myproject&quot;
  6421. recursive=&quot;true&quot;
  6422. label=&quot;Release1&quot;
  6423. login=&quot;me,mypassword&quot;
  6424. vsspath=&quot;/source/aProject&quot;
  6425. writable=&quot;true&quot;/&gt;
  6426. </pre>
  6427. </blockquote>
  6428. <p>Does a get on the VSS-Project <i>$/source/aproject</i> using the username
  6429. <i>me</i> and the password <i>mypassword</i>. It will recursively get the files
  6430. which are labeled <i>Release1</i> and write them to the local directory
  6431. <i>C:\mysrc\myproject</i>. The local files will be writable.</p>
  6432. <hr>
  6433. <h2><a name="buildevents">Build Events</a></h2>
  6434. Ant is capable of generating build events as it performs the tasks necessary to build a project.
  6435. Listeners can be attached to Ant to receive these events. This capability could be used, for example,
  6436. to connect Ant to a GUI or to integrate Ant with an IDE.
  6437. <p>To use build events you need to create an ant <code>Project</code> object. You can then call the
  6438. <code>addBuildListener</code> method to add your listener to the project. Your listener must implement
  6439. the <code>org.apache.tools.antBuildListener</code> interface. The listener will receive BuildEvents
  6440. for the following events
  6441. <ul>
  6442. <li>Build started
  6443. <li>Build finished
  6444. <li>Target started
  6445. <li>Target finished
  6446. <li>Task started
  6447. <li>Task finished
  6448. <li>Message logged
  6449. </ul>
  6450. If you wish to attach a listener from the command line you may use the
  6451. <code>-listener</code> option. For example:
  6452. <blockquote>
  6453. <pre>ant -listener org.apache.tools.ant.XmlLogger</pre>
  6454. </blockquote>
  6455. will run Ant with a listener that generates an XML representation of the build progress. This
  6456. listener is included with Ant, as is the default listener, which generates the logging to standard output.
  6457. <hr>
  6458. <h2><a name="writingowntask">Writing Your Own Task</a></h2>
  6459. <p>It is very easy to write your own task:</p>
  6460. <ol>
  6461. <li>Create a Java class that extends <code>org.apache.tools.ant.Task</code>.</li>
  6462. <li>For each attribute, write a <i>setter</i> method. The setter method must be a
  6463. <code>public void</code> method that takes a single argument. The
  6464. name of the method must begin with <code>set</code>, followed by the
  6465. attribute name, with the first character of the name in uppercase, and the rest in
  6466. lowercase. The type of the attribute can be:
  6467. <ul>
  6468. <li>
  6469. <code>String</code>
  6470. </li>
  6471. <li>
  6472. any primitive type (they are converted for you from their String-representation
  6473. in the buildfile)
  6474. </li>
  6475. <li>
  6476. boolean &#150; your method will be passed the value
  6477. <i>true</i> if the value specified in the buildfile is one of <code>true</code>,
  6478. <code>yes</code>, or <code>on</code>)
  6479. </li>
  6480. <li>
  6481. <code>Class</code>
  6482. <li>
  6483. <code>File</code>
  6484. (in which case the value of the attribute is interpreted relative to the
  6485. project's basedir)
  6486. </li>
  6487. <li>
  6488. any other type that has a constructor with a single
  6489. <code>String</code> argument
  6490. </li>
  6491. </ul>
  6492. <li>If your task has enumerated attributes, you should consider using
  6493. a subclass of <code>org.apache.tools.ant.types.EnumeratedAttribute</code>
  6494. as an argument
  6495. to your setter method. See
  6496. <code>org/apache/tools/ant/taskdefs/FixCRLF.java</code> for
  6497. an example.</li>
  6498. <li>If the task should support character data, write a <code>public void
  6499. addText(String)</code> method.</li>
  6500. <li>For each nested element, write a <i>create</i> or <i>add</i> method.
  6501. A create method
  6502. must be a <code>public</code> method that takes no arguments and returns
  6503. an <code>Object</code> type. The name of the create method must begin with
  6504. <code>create</code>, followed by the element name. An add method must be
  6505. a <code>public void</code> method that takes a single argument of an
  6506. <code>Object</code> type with a no-argument constructor.
  6507. The name of the add method
  6508. must begin with <code>add</code>, followed by the element name.
  6509. <li>Write a <code>public void execute</code> method, with no arguments, that
  6510. throws a <code>BuildException</code>. This method implements the task
  6511. itself.</li>
  6512. </ol>
  6513. <h3>The Life-cycle of a Task</h3>
  6514. <ol>
  6515. <li>The task gets instantiated using a no-argument constructor, at parser
  6516. time. This means even tasks that are never executed get
  6517. instantiated.</li>
  6518. <li>The task gets references to its project and location inside the
  6519. buildfile via its inherited <code>project</code> and
  6520. <code>location</code> variables.</li>
  6521. <li>If the user specified an <code>id</code> attribute to this task,
  6522. the project
  6523. registers a reference to this newly created task, at parser
  6524. time.</li>
  6525. <li>The task gets a reference to the target it belongs to via its
  6526. inherited <code>target</code> variable.</li>
  6527. <li><code>init()</code> is called at parser time.</li>
  6528. <li>All child elements of the XML element corresponding to this task
  6529. are created via this task's <code>createXXX()</code> methods or
  6530. instantiated and added to this task via its <code>addXXX()</code>
  6531. methods, at parser time.</li>
  6532. <li>All attributes of this task get set via their corresponding
  6533. <code>setXXX</code> methods, at runtime.</li>
  6534. <li>The content character data sections inside the XML element
  6535. corresponding to this task is added to the task via its
  6536. <code>addText</code> method, at runtime.</li>
  6537. <li>All attributes of all child elements get set via their corresponding
  6538. <code>setXXX</code> methods, at runtime.</li>
  6539. <li><code>execute()</code> is called at runtime. While the above initialization
  6540. steps only occur once, the execute() method may be
  6541. called more than once, if the task is invoked more than once. For example,
  6542. if <code>target1</code> and <code>target2</code> both depend
  6543. on <code>target3</code>, then running
  6544. <code>'ant target1 target2'</code> will run all tasks in
  6545. <code>target3</code> twice.</li>
  6546. </ol>
  6547. <h3>Example</h3>
  6548. <p>Let's write our own task, which prints a message on the
  6549. <code>System.out</code> stream.
  6550. The
  6551. task has one attribute, called <code>message</code>.</p>
  6552. <blockquote>
  6553. <pre>
  6554. package com.mydomain;
  6555. import org.apache.tools.ant.BuildException;
  6556. import org.apache.tools.ant.Task;
  6557. public class MyVeryOwnTask extends Task {
  6558. private String msg;
  6559. // The method executing the task
  6560. public void execute() throws BuildException {
  6561. System.out.println(msg);
  6562. }
  6563. // The setter for the &quot;message&quot; attribute
  6564. public void setMessage(String msg) {
  6565. this.msg = msg;
  6566. }
  6567. }
  6568. </pre>
  6569. </blockquote>
  6570. <p>It's really this simple ;-)</p>
  6571. <p>Adding your task to the system is rather simple too:</p>
  6572. <ol>
  6573. <li>Make sure the class that implements your task is in the classpath when
  6574. starting Ant.</li>
  6575. <li>Add a <code>&lt;taskdef&gt;</code> element to your project.
  6576. This actually adds your task to the system.</li>
  6577. <li>Use your task in the rest of the buildfile.</li>
  6578. </ol>
  6579. <h3>Example</h3>
  6580. <blockquote>
  6581. <pre>
  6582. &lt;?xml version=&quot;1.0&quot;?&gt;
  6583. &lt;project name=&quot;OwnTaskExample&quot; default=&quot;main&quot; basedir=&quot;.&quot;&gt;
  6584. &lt;taskdef name=&quot;mytask&quot; classname=&quot;com.mydomain.MyVeryOwnTask&quot;/&gt;
  6585. &lt;target name=&quot;main&quot;&gt;
  6586. &lt;mytask message=&quot;Hello World! MyVeryOwnTask works!&quot;/&gt;
  6587. &lt;/target&gt;
  6588. &lt;/project&gt;
  6589. </pre>
  6590. </blockquote>
  6591. <p>Another way to add a task (more permanently), is to add the task name and
  6592. implementing class name to the <code>default.properties</code> file in the
  6593. <code>org.apache.tools.ant.taskdefs</code>
  6594. package. Then you can use it as if it were a built-in task.</p>
  6595. <hr>
  6596. <h2><a name="faq">FAQ, DTD, External Resources</a></h2>
  6597. <p>There is an on-line FAQ for Ant at <a
  6598. href="http://jakarta.apache.org/jyve-faq/Turbine/screen/DisplayTopics/action/SetAll/project_id/2/faq_id/16">jakarta.apache.org</a>. This
  6599. FAQ is interactive, which means you can ask and answer questions
  6600. on line.</p>
  6601. <p>One of the questions popping up quite often is &quot;Is there a DTD for
  6602. buildfiles?&quot; Please refer to the FAQ for an answer.</p>
  6603. <hr>
  6604. <h2><a name="feedback">Feedback</a></h2>
  6605. <p>To provide feedback on this software, please subscribe to the Ant User
  6606. Mail List (<a href="mailto:ant-user-subscribe@jakarta.apache.org">ant-user-subscribe@jakarta.apache.org</a>)</p>
  6607. <p>If you want to contribute to Ant or stay current with the latest
  6608. development, join the Ant Development Mail List (<a
  6609. href="mailto:ant-dev-subscribe@jakarta.apache.org">ant-dev-subscribe@jakarta.apache.org</a>)</p>
  6610. <p>Archives of both lists can be found at <a
  6611. href="http://archive.covalent.net/">http://archive.covalent.net/</a>. Many
  6612. thanks to Covalent Technologies. A searchable archive can be found at <a
  6613. href="http://marc.theaimsgroup.com">http://marc.theaimsgroup.com</a>. If
  6614. you know of any additional archive sites, please report them to the
  6615. lists.</p>
  6616. <hr>
  6617. <p align="center">Copyright &copy; 2000,2001 Apache Software Foundation. All rights
  6618. Reserved.</p>
  6619. </body>
  6620. </html>