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.

faq.html 95 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <!-- Content Stylesheet for Site -->
  3. <!-- start the processing -->
  4. <html>
  5. <!-- GENERATED FILE, DO NOT EDIT, EDIT THE XML FILE IN xdocs INSTEAD! -->
  6. <head>
  7. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
  8. <meta name="author" value="Stefan Bodewig">
  9. <meta name="email" value="bodewig@apache.org">
  10. <title>Apache Ant - Frequently Asked Questions</title>
  11. </head>
  12. <body bgcolor="#ffffff" text="#000000" link="#525D76">
  13. <table border="0" width="100%" cellspacing="0">
  14. <!-- TOP IMAGE -->
  15. <tr>
  16. <td align="left">
  17. <a href="http://jakarta.apache.org"><img src="images/jakarta-logo.gif" border="0"/></a>
  18. </td>
  19. <td align="center">
  20. <a href="http://www.sdmagazine.com"><img src="images/sdm_productivity_award.gif" border="0" height="75" width="135"/></a>
  21. </td>
  22. <td align="center">
  23. <a href="http://www.javaworld.com"><img src="images/jw_ec_logo_winner2002.gif" border="0" height="85" width="230"/></a>
  24. </td>
  25. <td align="right">
  26. <a href="http://jakarta.apache.org/ant/"><img src="./images/ant_logo_large.gif" alt="Apache Ant" border="0"/></a>
  27. </td>
  28. </tr>
  29. </table>
  30. <table border="0" width="100%" cellspacing="4">
  31. <tr><td colspan="2">
  32. <hr noshade="" size="1"/>
  33. </td></tr>
  34. <tr>
  35. <!-- LEFT SIDE NAVIGATION -->
  36. <td valign="top" nowrap="true">
  37. <p><strong>Apache Ant</strong></p>
  38. <ul>
  39. <li> <a href="./index.html">Front Page</a>
  40. </li>
  41. <li> <a href="./antnews.html">News</a>
  42. </li>
  43. <li> <a href="./manual/index.html">Documentation</a>
  44. </li>
  45. <li> <a href="./projects.html">Related Projects</a>
  46. </li>
  47. <li> <a href="./external.html">External Tools and Tasks</a>
  48. </li>
  49. <li> <a href="./resources.html">Resources</a>
  50. </li>
  51. <li> <a href="./faq.html">Ant FAQ</a>
  52. </li>
  53. <li> <a href="./problems.html">Having Problems?</a>
  54. </li>
  55. </ul>
  56. <p><strong>Download</strong></p>
  57. <ul>
  58. <li> <a href="http://jakarta.apache.org/site/binindex.html">Binaries</a>
  59. </li>
  60. <li> <a href="http://jakarta.apache.org/site/sourceindex.html">Source Code</a>
  61. </li>
  62. </ul>
  63. <p><strong>Jakarta</strong></p>
  64. <ul>
  65. <li> <a href="http://jakarta.apache.org/site/news.html">News & Status</a>
  66. </li>
  67. <li> <a href="http://jakarta.apache.org/site/mission.html">Mission</a>
  68. </li>
  69. <li> <a href="http://jakarta.apache.org/site/guidelines.html">Guidelines Notes</a>
  70. </li>
  71. <li> <a href="http://jakarta.apache.org/site/faqs.html">FAQs</a>
  72. </li>
  73. </ul>
  74. <p><strong>Get Involved</strong></p>
  75. <ul>
  76. <li> <a href="http://jakarta.apache.org/site/getinvolved.html">Overview</a>
  77. </li>
  78. <li> <a href="http://jakarta.apache.org/site/cvsindex.html">CVS Repositories</a>
  79. </li>
  80. <li> <a href="http://jakarta.apache.org/site/mail.html">Mailing Lists</a>
  81. </li>
  82. <li> <a href="http://jakarta.apache.org/site/library.html">Reference Library</a>
  83. </li>
  84. <li> <a href="http://nagoya.apache.org/bugzilla/enter_bug.cgi?product=Ant">Bug Database</a>
  85. </li>
  86. <li> <a href="http://nagoya.apache.org/bugzilla/enter_bug.cgi?product=Ant&bug_severity=Enhancement">Enhancement Requests</a>
  87. </li>
  88. <li> <a href="http://nagoya.apache.org/bugzilla/buglist.cgi?bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&email1=&emailtype1=substring&emailassigned_to1=1&email2=&emailtype2=substring&emailreporter2=1&bugidtype=include&bug_id=&changedin=&votes=&chfieldfrom=&chfieldto=Now&chfieldvalue=&product=Ant&short_desc=%5BPATCH%5D&short_desc_type=allwordssubstr&long_desc=&long_desc_type=allwordssubstr&bug_file_loc=&bug_file_loc_type=allwordssubstr&keywords=&keywords_type=anywords&field0-0-0=noop&type0-0-0=noop&value0-0-0=&cmdtype=doit&order=Reuse+same+sort+as+last+time">Patch Queue</a>
  89. </li>
  90. </ul>
  91. </td>
  92. <td align="left" valign="top">
  93. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  94. <tr><td bgcolor="#525D76">
  95. <font color="#ffffff" face="arial,helvetica,sanserif">
  96. <strong>Questions</strong>
  97. </font>
  98. </td></tr>
  99. <tr><td>
  100. <blockquote>
  101. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  102. <tr><td bgcolor="#828DA6">
  103. <font color="#ffffff" face="arial,helvetica,sanserif">
  104. <strong>About this FAQ</strong>
  105. </font>
  106. </td></tr>
  107. <tr><td>
  108. <blockquote>
  109. <ul>
  110. <li><a href="#latest-version">
  111. Where do I find the latest version of this
  112. document?
  113. </a></li>
  114. <li><a href="#adding-faqs">
  115. How can I contribute to this FAQ?
  116. </a></li>
  117. <li><a href="#creating-faq">
  118. How do you create the HTML version of this
  119. FAQ?
  120. </a></li>
  121. </ul>
  122. </blockquote>
  123. </td></tr>
  124. </table>
  125. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  126. <tr><td bgcolor="#828DA6">
  127. <font color="#ffffff" face="arial,helvetica,sanserif">
  128. <strong>General</strong>
  129. </font>
  130. </td></tr>
  131. <tr><td>
  132. <blockquote>
  133. <ul>
  134. <li><a href="#what-is-ant">
  135. What is Apache Ant?
  136. </a></li>
  137. <li><a href="#ant-name">
  138. Why do you call it Ant?
  139. </a></li>
  140. <li><a href="#history">
  141. Tell us a little bit about Ant's history.
  142. </a></li>
  143. </ul>
  144. </blockquote>
  145. </td></tr>
  146. </table>
  147. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  148. <tr><td bgcolor="#828DA6">
  149. <font color="#ffffff" face="arial,helvetica,sanserif">
  150. <strong>Installation</strong>
  151. </font>
  152. </td></tr>
  153. <tr><td>
  154. <blockquote>
  155. <ul>
  156. <li><a href="#no-gnu-tar">
  157. I get checksum errors when I try to extract the
  158. <code>tar.gz</code> distribution file. Why?
  159. </a></li>
  160. </ul>
  161. </blockquote>
  162. </td></tr>
  163. </table>
  164. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  165. <tr><td bgcolor="#828DA6">
  166. <font color="#ffffff" face="arial,helvetica,sanserif">
  167. <strong>Using Ant</strong>
  168. </font>
  169. </td></tr>
  170. <tr><td>
  171. <blockquote>
  172. <ul>
  173. <li><a href="#always-recompiles">
  174. Why does Ant always recompile all my Java files?
  175. </a></li>
  176. <li><a href="#passing-cli-args">
  177. How do I pass parameters from the command line to my
  178. build file?
  179. </a></li>
  180. <li><a href="#jikes-switches">
  181. How can I use Jikes-specific command-line
  182. switches?
  183. </a></li>
  184. <li><a href="#shell-redirect-1">
  185. How do I include a &lt; character in my command-line arguments?
  186. </a></li>
  187. <li><a href="#shell-redirect-2">
  188. How do I redirect standard input or standard output
  189. in the <code>&lt;exec&gt;</code> task?
  190. </a></li>
  191. <li><a href="#batch-shell-execute">
  192. How do I execute a batch file or shell script from Ant?
  193. </a></li>
  194. <li><a href="#defaultexcludes">
  195. I've used a <code>&lt;delete&gt;</code> task to delete
  196. unwanted
  197. SourceSafe control files (CVS files, editor backup files, etc.), but
  198. it doesn't seem to work; the files never get deleted. What's
  199. wrong?
  200. </a></li>
  201. <li><a href="#multi-conditions">
  202. I want to execute a particular target only if
  203. multiple conditions are true.
  204. </a></li>
  205. <li><a href="#stop-dependency">
  206. I have a target I want to skip if a property is set,
  207. so I have <code>unless="property"</code> as an attribute
  208. of the target, but all the targets this target
  209. depends on are still executed. Why?
  210. </a></li>
  211. <li><a href="#include-order">
  212. In my <code>&lt;fileset&gt;</code>, I've put in an
  213. <code>&lt;exclude&gt;</code> of all files followed by an
  214. <code>&lt;include&gt;</code> of just the files I want, but it
  215. isn't giving me any files at all. What's wrong?
  216. </a></li>
  217. <li><a href="#encoding">
  218. How can I include national characters like German
  219. umlauts in my build file?
  220. </a></li>
  221. </ul>
  222. </blockquote>
  223. </td></tr>
  224. </table>
  225. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  226. <tr><td bgcolor="#828DA6">
  227. <font color="#ffffff" face="arial,helvetica,sanserif">
  228. <strong>Ant and IDEs/Editors</strong>
  229. </font>
  230. </td></tr>
  231. <tr><td>
  232. <blockquote>
  233. <ul>
  234. <li><a href="#integration">
  235. Is Ant supported by my IDE/Editor?
  236. </a></li>
  237. <li><a href="#emacs-mode">
  238. Why doesn't (X)Emacs/vi/MacOS X's project builder
  239. correctly parse the error messages generated by Ant?
  240. </a></li>
  241. </ul>
  242. </blockquote>
  243. </td></tr>
  244. </table>
  245. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  246. <tr><td bgcolor="#828DA6">
  247. <font color="#ffffff" face="arial,helvetica,sanserif">
  248. <strong>Advanced Issues</strong>
  249. </font>
  250. </td></tr>
  251. <tr><td>
  252. <blockquote>
  253. <ul>
  254. <li><a href="#dtd">
  255. Is there a DTD that I can use to validate my build
  256. files?
  257. </a></li>
  258. <li><a href="#xml-entity-include">
  259. How do I include an XML snippet in my build file?
  260. </a></li>
  261. <li><a href="#mail-logger">
  262. How do I send an email with the result of my build
  263. process?
  264. </a></li>
  265. <li><a href="#listener-properties">
  266. How do I get at the properties that Ant was running
  267. with from inside BuildListener?
  268. </a></li>
  269. </ul>
  270. </blockquote>
  271. </td></tr>
  272. </table>
  273. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  274. <tr><td bgcolor="#828DA6">
  275. <font color="#ffffff" face="arial,helvetica,sanserif">
  276. <strong>Known Problems</strong>
  277. </font>
  278. </td></tr>
  279. <tr><td>
  280. <blockquote>
  281. <ul>
  282. <li><a href="#remove-cr">
  283. &lt;chmod&gt; or &lt;exec&gt; doesn't work in Ant
  284. 1.3 on Unix
  285. </a></li>
  286. <li><a href="#javadoc-cannot-execute">
  287. JavaDoc failed: java.io.IOException: javadoc: cannot execute
  288. </a></li>
  289. <li><a href="#delegating-classloader">
  290. &lt;style&gt; or &lt;junit&gt; ignores my
  291. &lt;classpath&gt;
  292. </a></li>
  293. <li><a href="#1.5-cygwin-sh">
  294. The <code>ant</code> wrapper script of Ant 1.5 fails
  295. for Cygwin if <code>ANT_HOME</code> is set to a Windows style
  296. path.
  297. </a></li>
  298. </ul>
  299. </blockquote>
  300. </td></tr>
  301. </table>
  302. </blockquote>
  303. </td></tr>
  304. </table>
  305. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  306. <tr><td bgcolor="#525D76">
  307. <font color="#ffffff" face="arial,helvetica,sanserif">
  308. <strong>Answers</strong>
  309. </font>
  310. </td></tr>
  311. <tr><td>
  312. <blockquote>
  313. <a name="latest-version">
  314. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  315. <tr><td bgcolor="#828DA6">
  316. <font color="#ffffff" face="arial,helvetica,sanserif">
  317. <strong>
  318. Where do I find the latest version of this
  319. document?
  320. </strong>
  321. </font>
  322. </td></tr>
  323. <tr><td>
  324. <blockquote>
  325. <p>The latest version can always be found at Ant's homepage
  326. <a href="http://jakarta.apache.org/ant/faq.html">http://jakarta.apache.org/ant/faq.html</a>.</p>
  327. </blockquote>
  328. </td></tr>
  329. </table>
  330. </a>
  331. <a name="adding-faqs">
  332. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  333. <tr><td bgcolor="#828DA6">
  334. <font color="#ffffff" face="arial,helvetica,sanserif">
  335. <strong>
  336. How can I contribute to this FAQ?
  337. </strong>
  338. </font>
  339. </td></tr>
  340. <tr><td>
  341. <blockquote>
  342. <p>The page you are looking it is generated from
  343. <a href="http://cvs.apache.org/viewcvs.cgi/~checkout~/jakarta-ant/xdocs/faq.xml">this</a>
  344. document. If you want to add a new question, please submit
  345. a patch against this document to one of Ant's mailing lists;
  346. hopefully, the structure is self-explanatory.</p>
  347. <p>If you don't know how to create a patch, see the patches
  348. section of <a href="http://jakarta.apache.org/site/source.html">this
  349. page</a>.</p>
  350. </blockquote>
  351. </td></tr>
  352. </table>
  353. </a>
  354. <a name="creating-faq">
  355. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  356. <tr><td bgcolor="#828DA6">
  357. <font color="#ffffff" face="arial,helvetica,sanserif">
  358. <strong>
  359. How do you create the HTML version of this
  360. FAQ?
  361. </strong>
  362. </font>
  363. </td></tr>
  364. <tr><td>
  365. <blockquote>
  366. <p>We use
  367. <a href="http://jakarta.apache.org/velocity/anakia.html">Anakia</a>
  368. to render the HTML version from the original XML file.</p>
  369. <p>The Velocity stylesheets used to process the XML files can
  370. be found in the <code>xdocs/stylesheets</code> subdirectory of
  371. Ant's CVS repository - the build file <code>docs.xml</code> is
  372. used to drive Anakia. This file assumes that you have the
  373. <code>jakarta-site2</code> module checked out from CVS as
  374. well, but if you follow the instruction from Anakia's
  375. homepage, you should get it to work without that. Just make
  376. sure all required jars are in the task's classpath.</p>
  377. </blockquote>
  378. </td></tr>
  379. </table>
  380. </a>
  381. <a name="what-is-ant">
  382. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  383. <tr><td bgcolor="#828DA6">
  384. <font color="#ffffff" face="arial,helvetica,sanserif">
  385. <strong>
  386. What is Apache Ant?
  387. </strong>
  388. </font>
  389. </td></tr>
  390. <tr><td>
  391. <blockquote>
  392. <p> Ant is a Java-based build tool. In theory, it is kind of
  393. like Make, without Make's wrinkles and with the full
  394. portability of pure Java code.</p>
  395. </blockquote>
  396. </td></tr>
  397. </table>
  398. </a>
  399. <a name="ant-name">
  400. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  401. <tr><td bgcolor="#828DA6">
  402. <font color="#ffffff" face="arial,helvetica,sanserif">
  403. <strong>
  404. Why do you call it Ant?
  405. </strong>
  406. </font>
  407. </td></tr>
  408. <tr><td>
  409. <blockquote>
  410. <p>According to Ant's original author, James Duncan
  411. Davidson, the name is an acronym for "Another Neat
  412. Tool".</p>
  413. <p>Later explanations go along the lines of "ants
  414. do an extremely good job at building things", or
  415. "ants are very small and can carry a weight dozens of times
  416. their own" - describing what Ant is intended to
  417. be.</p>
  418. </blockquote>
  419. </td></tr>
  420. </table>
  421. </a>
  422. <a name="history">
  423. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  424. <tr><td bgcolor="#828DA6">
  425. <font color="#ffffff" face="arial,helvetica,sanserif">
  426. <strong>
  427. Tell us a little bit about Ant's history.
  428. </strong>
  429. </font>
  430. </td></tr>
  431. <tr><td>
  432. <blockquote>
  433. <p>Initially, Ant was part of the Tomcat code base, when it was
  434. donated to the Apache Software Foundation. It was
  435. created by James Duncan Davidson, who is also the original
  436. author of Tomcat. Ant was there to build Tomcat, nothing
  437. else.</p>
  438. <p>Soon thereafter, several open source Java projects realized
  439. that Ant could solve the problems they had with Makefiles.
  440. Starting with the projects hosted at Jakarta and the old Java
  441. Apache project, Ant spread like a virus and is now the build
  442. tool of choice for a lot of projects.</p>
  443. <p>In January 2000, Ant was moved to a separate CVS module and
  444. was promoted to a project of its own, independent of
  445. Tomcat, and became Apache Ant.</p>
  446. <p>The first version of Ant that was exposed to a larger audience
  447. was the one that shipped with Tomcat's 3.1 release on 19 April
  448. 2000. This version has later been referred to as Ant
  449. 0.3.1.</p>
  450. <p>The first official release of Ant as a stand-alone product was
  451. Ant 1.1, released on 19 July 2000. The complete release
  452. history:</p>
  453. <table>
  454. <tr>
  455. <td bgcolor="#039acc" colspan="" rowspan=""
  456. valign="top" align="left">
  457. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  458. Ant Version
  459. </font>
  460. </td>
  461. <td bgcolor="#039acc" colspan="" rowspan=""
  462. valign="top" align="left">
  463. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  464. Release Date
  465. </font>
  466. </td>
  467. </tr>
  468. <tr>
  469. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  470. valign="top" align="left">
  471. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  472. 1.1
  473. </font>
  474. </td>
  475. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  476. valign="top" align="left">
  477. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  478. 19 July 2000
  479. </font>
  480. </td>
  481. </tr>
  482. <tr>
  483. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  484. valign="top" align="left">
  485. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  486. 1.2
  487. </font>
  488. </td>
  489. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  490. valign="top" align="left">
  491. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  492. 24 October 2000
  493. </font>
  494. </td>
  495. </tr>
  496. <tr>
  497. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  498. valign="top" align="left">
  499. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  500. 1.3
  501. </font>
  502. </td>
  503. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  504. valign="top" align="left">
  505. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  506. 3 March 2001
  507. </font>
  508. </td>
  509. </tr>
  510. <tr>
  511. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  512. valign="top" align="left">
  513. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  514. 1.4
  515. </font>
  516. </td>
  517. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  518. valign="top" align="left">
  519. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  520. 3 September 2001
  521. </font>
  522. </td>
  523. </tr>
  524. <tr>
  525. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  526. valign="top" align="left">
  527. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  528. 1.4.1
  529. </font>
  530. </td>
  531. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  532. valign="top" align="left">
  533. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  534. 11 October 2001
  535. </font>
  536. </td>
  537. </tr>
  538. <tr>
  539. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  540. valign="top" align="left">
  541. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  542. 1.5
  543. </font>
  544. </td>
  545. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  546. valign="top" align="left">
  547. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  548. 10 July 2002
  549. </font>
  550. </td>
  551. </tr>
  552. </table>
  553. </blockquote>
  554. </td></tr>
  555. </table>
  556. </a>
  557. <a name="no-gnu-tar">
  558. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  559. <tr><td bgcolor="#828DA6">
  560. <font color="#ffffff" face="arial,helvetica,sanserif">
  561. <strong>
  562. I get checksum errors when I try to extract the
  563. <code>tar.gz</code> distribution file. Why?
  564. </strong>
  565. </font>
  566. </td></tr>
  567. <tr><td>
  568. <blockquote>
  569. <p>Ant's distribution contains file names that are longer
  570. than 100 characters, which is not supported by the standard
  571. tar file format. Several different implementations of tar use
  572. different and incompatible ways to work around this
  573. restriction.</p>
  574. <p>Ant's &lt;tar&gt; task can create tar archives that use
  575. the GNU tar extension, and this has been used when putting
  576. together the distribution. If you are using a different
  577. version of tar (for example, the one shipping with Solaris),
  578. you cannot use it to extract the archive.</p>
  579. <p>The solution is to either install GNU tar, which can be
  580. found <a href="http://www.gnu.org/software/tar/tar.html">here</a>,
  581. or use the zip archive instead (you can extract it using
  582. <code>jar xf</code>).</p>
  583. </blockquote>
  584. </td></tr>
  585. </table>
  586. </a>
  587. <a name="always-recompiles">
  588. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  589. <tr><td bgcolor="#828DA6">
  590. <font color="#ffffff" face="arial,helvetica,sanserif">
  591. <strong>
  592. Why does Ant always recompile all my Java files?
  593. </strong>
  594. </font>
  595. </td></tr>
  596. <tr><td>
  597. <blockquote>
  598. <p>In order to find out which files should be compiled, Ant
  599. compares the timestamps of the source files to those of the
  600. resulting <code>.class</code> files. Opening all source files
  601. to find out which package they belong to would be very
  602. inefficient. Instead, Ant expects you to place your
  603. source files in a directory hierarchy that mirrors your
  604. package hierarchy and to point Ant to the root of this
  605. directory tree with the <code>srcdir</code> attribute.</p>
  606. <p>Say you have <code>&lt;javac srcdir="src"
  607. destdir="dest"/&gt;</code>. If Ant finds a file
  608. <code>src/a/b/C.java</code>, it expects it to be in package
  609. <code>a.b</code> so that the resulting <code>.class</code>
  610. file is going to be <code>dest/a/b/C.class</code>.</p>
  611. <p>If your source-tree directory structure does not match your
  612. package structure, Ant's heuristic won't work, and
  613. it will recompile classes that are up-to-date. Ant is not the
  614. only tool that expects a source-tree layout like this.</p>
  615. <p>If you have Java source files that aren't declared to
  616. be part of any package, you can still use the <code>&lt;javac&gt;</code>
  617. task to compile these files correctly - just set the
  618. <code>srcdir</code> and <code>destdir</code> attributes to
  619. the actual directory the source
  620. files live in and the directory the class files should go into,
  621. respectively.</p>
  622. </blockquote>
  623. </td></tr>
  624. </table>
  625. </a>
  626. <a name="passing-cli-args">
  627. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  628. <tr><td bgcolor="#828DA6">
  629. <font color="#ffffff" face="arial,helvetica,sanserif">
  630. <strong>
  631. How do I pass parameters from the command line to my
  632. build file?
  633. </strong>
  634. </font>
  635. </td></tr>
  636. <tr><td>
  637. <blockquote>
  638. <p>Use properties. Using <code>ant
  639. -D<em>name</em>=<em>value</em></code> lets you define values for
  640. properties on the Ant command line. These properties can then be
  641. used within your build file as
  642. any normal property: <code>${<em>name</em>}</code> will put in
  643. <code><em>value</em></code>.</p>
  644. </blockquote>
  645. </td></tr>
  646. </table>
  647. </a>
  648. <a name="jikes-switches">
  649. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  650. <tr><td bgcolor="#828DA6">
  651. <font color="#ffffff" face="arial,helvetica,sanserif">
  652. <strong>
  653. How can I use Jikes-specific command-line
  654. switches?
  655. </strong>
  656. </font>
  657. </td></tr>
  658. <tr><td>
  659. <blockquote>
  660. <p>A couple of switches are supported via "magic"
  661. properties:</p>
  662. <table>
  663. <tr>
  664. <td bgcolor="#039acc" colspan="" rowspan=""
  665. valign="top" align="left">
  666. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  667. switch
  668. </font>
  669. </td>
  670. <td bgcolor="#039acc" colspan="" rowspan=""
  671. valign="top" align="left">
  672. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  673. property
  674. </font>
  675. </td>
  676. <td bgcolor="#039acc" colspan="" rowspan=""
  677. valign="top" align="left">
  678. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  679. default
  680. </font>
  681. </td>
  682. </tr>
  683. <tr>
  684. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  685. valign="top" align="left">
  686. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  687. +E
  688. </font>
  689. </td>
  690. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  691. valign="top" align="left">
  692. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  693. build.compiler.emacs
  694. </font>
  695. </td>
  696. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  697. valign="top" align="left">
  698. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  699. false == not set
  700. </font>
  701. </td>
  702. </tr>
  703. <tr>
  704. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  705. valign="top" align="left">
  706. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  707. +P
  708. </font>
  709. </td>
  710. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  711. valign="top" align="left">
  712. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  713. build.compiler.pedantic
  714. </font>
  715. </td>
  716. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  717. valign="top" align="left">
  718. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  719. false == not set
  720. </font>
  721. </td>
  722. </tr>
  723. <tr>
  724. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  725. valign="top" align="left">
  726. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  727. +F
  728. </font>
  729. </td>
  730. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  731. valign="top" align="left">
  732. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  733. build.compiler.fulldepend
  734. </font>
  735. </td>
  736. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  737. valign="top" align="left">
  738. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  739. false == not set
  740. </font>
  741. </td>
  742. </tr>
  743. <tr>
  744. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  745. valign="top" align="left">
  746. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  747. <strong>(Only for Ant &lt; 1.4; replaced by the
  748. <code><strong>nowarn</strong></code>
  749. attribute of the <code><strong>&lt;javac&gt;</strong></code>
  750. task after that.)</strong><br />-nowarn
  751. </font>
  752. </td>
  753. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  754. valign="top" align="left">
  755. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  756. build.compiler.warnings
  757. </font>
  758. </td>
  759. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  760. valign="top" align="left">
  761. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  762. true == not set
  763. </font>
  764. </td>
  765. </tr>
  766. </table>
  767. <p>With Ant &gt;= 1.5, you can also use nested
  768. <code>&lt;compilerarg&gt;</code> elements with the
  769. <code>&lt;javac&gt;</code> task.</p>
  770. </blockquote>
  771. </td></tr>
  772. </table>
  773. </a>
  774. <a name="shell-redirect-1">
  775. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  776. <tr><td bgcolor="#828DA6">
  777. <font color="#ffffff" face="arial,helvetica,sanserif">
  778. <strong>
  779. How do I include a &lt; character in my command-line arguments?
  780. </strong>
  781. </font>
  782. </td></tr>
  783. <tr><td>
  784. <blockquote>
  785. <p>The short answer is "Use: <code>&amp;lt;</code>".</p>
  786. <p>The long answer is that this probably won't do what you
  787. want anyway (see <a href="#shell-redirect-2">the next
  788. section</a>).</p>
  789. </blockquote>
  790. </td></tr>
  791. </table>
  792. </a>
  793. <a name="shell-redirect-2">
  794. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  795. <tr><td bgcolor="#828DA6">
  796. <font color="#ffffff" face="arial,helvetica,sanserif">
  797. <strong>
  798. How do I redirect standard input or standard output
  799. in the <code>&lt;exec&gt;</code> task?
  800. </strong>
  801. </font>
  802. </td></tr>
  803. <tr><td>
  804. <blockquote>
  805. <p>Say you want to redirect the standard input stream of the
  806. <code>cat</code> command to read from a file, something
  807. like:</p>
  808. <div align="left">
  809. <table cellspacing="4" cellpadding="0" border="0">
  810. <tr>
  811. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  812. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  813. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  814. </tr>
  815. <tr>
  816. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  817. <td bgcolor="#ffffff"><pre>
  818. shell-prompt&gt; cat &lt; foo
  819. </pre></td>
  820. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  821. </tr>
  822. <tr>
  823. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  824. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  825. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  826. </tr>
  827. </table>
  828. </div>
  829. <p>and try to translate it into</p>
  830. <div align="left">
  831. <table cellspacing="4" cellpadding="0" border="0">
  832. <tr>
  833. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  834. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  835. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  836. </tr>
  837. <tr>
  838. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  839. <td bgcolor="#ffffff"><pre>
  840. &lt;exec executable=&quot;cat&quot;&gt;
  841. &lt;arg value=&quot;&amp;lt;&quot; /&gt;
  842. &lt;arg value=&quot;foo&quot; /&gt;
  843. &lt;/exec&gt;
  844. </pre></td>
  845. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  846. </tr>
  847. <tr>
  848. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  849. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  850. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  851. </tr>
  852. </table>
  853. </div>
  854. <p>This will not do what you expect. The input redirection is
  855. performed by your shell, not the command itself, so this
  856. should read:</p>
  857. <div align="left">
  858. <table cellspacing="4" cellpadding="0" border="0">
  859. <tr>
  860. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  861. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  862. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  863. </tr>
  864. <tr>
  865. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  866. <td bgcolor="#ffffff"><pre>
  867. &lt;exec executable=&quot;/bin/sh&quot;&gt;
  868. &lt;arg value=&quot;-c&quot; /&gt;
  869. &lt;arg value=&quot;cat &amp;lt; foo&quot; /&gt;
  870. &lt;/exec&gt;
  871. </pre></td>
  872. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  873. </tr>
  874. <tr>
  875. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  876. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  877. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  878. </tr>
  879. </table>
  880. </div>
  881. <p>Note that you must use the <code>value</code> attribute of
  882. <code>&lt;arg&gt;</code> in the last element, in order to have
  883. the command passed as a single, quoted argument. Alternatively,
  884. you can use:</p>
  885. <div align="left">
  886. <table cellspacing="4" cellpadding="0" border="0">
  887. <tr>
  888. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  889. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  890. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  891. </tr>
  892. <tr>
  893. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  894. <td bgcolor="#ffffff"><pre>
  895. &lt;exec executable=&quot;/bin/sh&quot;&gt;
  896. &lt;arg line='-c &quot;cat &amp;lt; foo&quot;'/&gt;
  897. &lt;/exec&gt;
  898. </pre></td>
  899. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  900. </tr>
  901. <tr>
  902. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  903. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  904. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  905. </tr>
  906. </table>
  907. </div>
  908. <p>Note the double-quotes nested inside the single-quotes.</p>
  909. </blockquote>
  910. </td></tr>
  911. </table>
  912. </a>
  913. <a name="batch-shell-execute">
  914. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  915. <tr><td bgcolor="#828DA6">
  916. <font color="#ffffff" face="arial,helvetica,sanserif">
  917. <strong>
  918. How do I execute a batch file or shell script from Ant?
  919. </strong>
  920. </font>
  921. </td></tr>
  922. <tr><td>
  923. <blockquote>
  924. <p>On native Unix systems, you should be able to run shell scripts
  925. directly. On systems running a Unix-type shell (for example, Cygwin
  926. on Windows) execute the (command) shell instead - <code>cmd</code>
  927. for batch files, <code>sh</code> for shell scripts - then pass the
  928. batch file or shell script (plus any arguments to the script)
  929. as a single command, using the <code>/c</code> or
  930. <code>-c</code> switch, respectively. See
  931. <a href="#shell-redirect-2">the above section</a>
  932. for example <code>&lt;exec&gt;</code> tasks
  933. executing <code>sh</code>. For batch files, use something like:</p>
  934. <div align="left">
  935. <table cellspacing="4" cellpadding="0" border="0">
  936. <tr>
  937. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  938. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  939. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  940. </tr>
  941. <tr>
  942. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  943. <td bgcolor="#ffffff"><pre>
  944. &lt;exec dir=&quot;.&quot; executable=&quot;cmd&quot; os=&quot;Windows NT&quot;&gt;
  945. &lt;arg line=&quot;/c test.bat&quot;/&gt;
  946. &lt;/exec&gt;
  947. </pre></td>
  948. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  949. </tr>
  950. <tr>
  951. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  952. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  953. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  954. </tr>
  955. </table>
  956. </div>
  957. </blockquote>
  958. </td></tr>
  959. </table>
  960. </a>
  961. <a name="defaultexcludes">
  962. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  963. <tr><td bgcolor="#828DA6">
  964. <font color="#ffffff" face="arial,helvetica,sanserif">
  965. <strong>
  966. I've used a <code>&lt;delete&gt;</code> task to delete
  967. unwanted
  968. SourceSafe control files (CVS files, editor backup files, etc.), but
  969. it doesn't seem to work; the files never get deleted. What's
  970. wrong?
  971. </strong>
  972. </font>
  973. </td></tr>
  974. <tr><td>
  975. <blockquote>
  976. <p>This is probably happening because, by default, Ant excludes
  977. SourceSafe control files (<code>vssver.scc</code>) and certain other
  978. files from FileSets.</p>
  979. <p>Here's what you probably did:</p>
  980. <div align="left">
  981. <table cellspacing="4" cellpadding="0" border="0">
  982. <tr>
  983. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  984. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  985. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  986. </tr>
  987. <tr>
  988. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  989. <td bgcolor="#ffffff"><pre>
  990. &lt;delete&gt;
  991. &lt;fileset dir=&quot;${build.src}&quot; includes=&quot;**/vssver.scc&quot;/&gt;
  992. &lt;/delete&gt;
  993. </pre></td>
  994. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  995. </tr>
  996. <tr>
  997. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  998. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  999. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1000. </tr>
  1001. </table>
  1002. </div>
  1003. <p>You need to switch off the default exclusions,
  1004. and it will work:</p>
  1005. <div align="left">
  1006. <table cellspacing="4" cellpadding="0" border="0">
  1007. <tr>
  1008. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1009. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1010. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1011. </tr>
  1012. <tr>
  1013. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1014. <td bgcolor="#ffffff"><pre>
  1015. &lt;delete&gt;
  1016. &lt;fileset dir=&quot;${build.src}&quot; includes=&quot;**/vssver.scc&quot;
  1017. defaultexcludes=&quot;no&quot;/&gt;
  1018. &lt;/delete&gt;
  1019. </pre></td>
  1020. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1021. </tr>
  1022. <tr>
  1023. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1024. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1025. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1026. </tr>
  1027. </table>
  1028. </div>
  1029. <p>For a complete listing of the patterns that are excluded
  1030. by default, see <a href="manual/dirtasks.html#defaultexcludes">the user
  1031. manual</a>.</p>
  1032. </blockquote>
  1033. </td></tr>
  1034. </table>
  1035. </a>
  1036. <a name="multi-conditions">
  1037. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  1038. <tr><td bgcolor="#828DA6">
  1039. <font color="#ffffff" face="arial,helvetica,sanserif">
  1040. <strong>
  1041. I want to execute a particular target only if
  1042. multiple conditions are true.
  1043. </strong>
  1044. </font>
  1045. </td></tr>
  1046. <tr><td>
  1047. <blockquote>
  1048. <p>There are actually several answers to this question.</p>
  1049. <p>If you have only one set and one unset property to test,
  1050. you can specify both an <code>if</code> and an <code>unless</code>
  1051. attribute for the target, and they will act as if they
  1052. are "anded" together.</p>
  1053. <p>If you are using a version of Ant 1.3 or earlier, the
  1054. way to work with all other cases is to chain targets together
  1055. to determine the specific state you want to test for.</p>
  1056. <p>To see how this works, assume you have three properties:
  1057. <code>prop1</code>, <code>prop2</code>, and <code>prop3</code>.
  1058. You want to test that <code>prop1</code> and <code>prop2</code>
  1059. are set, and that <code>prop3</code> is not. If the condition
  1060. holds true you want to echo "yes".</p>
  1061. <p>Here is the implementation in Ant 1.3 and earlier:</p>
  1062. <div align="left">
  1063. <table cellspacing="4" cellpadding="0" border="0">
  1064. <tr>
  1065. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1066. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1067. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1068. </tr>
  1069. <tr>
  1070. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1071. <td bgcolor="#ffffff"><pre>
  1072. &lt;target name=&quot;cond&quot; depends=&quot;cond-if&quot;/&gt;
  1073. &lt;target name=&quot;cond-if&quot; if=&quot;prop1&quot;&gt;
  1074. &lt;antcall target=&quot;cond-if-2&quot;/&gt;
  1075. &lt;/target&gt;
  1076. &lt;target name=&quot;cond-if-2&quot; if=&quot;prop2&quot;&gt;
  1077. &lt;antcall target=&quot;cond-if-3&quot;/&gt;
  1078. &lt;/target&gt;
  1079. &lt;target name=&quot;cond-if-3&quot; unless=&quot;prop3&quot;&gt;
  1080. &lt;echo message=&quot;yes&quot;/&gt;
  1081. &lt;/target&gt;
  1082. </pre></td>
  1083. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1084. </tr>
  1085. <tr>
  1086. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1087. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1088. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1089. </tr>
  1090. </table>
  1091. </div>
  1092. <p>Note: <code>&lt;antcall&gt;</code> tasks do <em>not</em> pass
  1093. property changes back up to the environment they were called
  1094. from, so you would'nt be able to, for example, set a
  1095. <code>result</code> property in the <code>cond-if-3</code> target,
  1096. then do
  1097. <code>&lt;echo message="result is ${result}"/&gt;</code>
  1098. in the <code>cond</code> target.</p>
  1099. <p>Starting with Ant 1.4, you can use the
  1100. <code>&lt;condition&gt;</code> task.</p>
  1101. <div align="left">
  1102. <table cellspacing="4" cellpadding="0" border="0">
  1103. <tr>
  1104. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1105. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1106. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1107. </tr>
  1108. <tr>
  1109. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1110. <td bgcolor="#ffffff"><pre>
  1111. &lt;target name=&quot;cond&quot; depends=&quot;cond-if,cond-else&quot;/&gt;
  1112. &lt;target name=&quot;check-cond&quot;&gt;
  1113. &lt;condition property=&quot;cond-is-true&quot;&gt;
  1114. &lt;and&gt;
  1115. &lt;not&gt;
  1116. &lt;equals arg1=&quot;${prop1}&quot; arg2=&quot;$${prop1}&quot; /&gt;
  1117. &lt;/not&gt;
  1118. &lt;not&gt;
  1119. &lt;equals arg1=&quot;${prop2}&quot; arg2=&quot;$${prop2}&quot; /&gt;
  1120. &lt;/not&gt;
  1121. &lt;equals arg1=&quot;${prop3}&quot; arg2=&quot;$${prop3}&quot; /&gt;
  1122. &lt;/and&gt;
  1123. &lt;/condition&gt;
  1124. &lt;/target&gt;
  1125. &lt;target name=&quot;cond-if&quot; depends=&quot;check-cond&quot; if=&quot;cond-is-true&quot;&gt;
  1126. &lt;echo message=&quot;yes&quot;/&gt;
  1127. &lt;/target&gt;
  1128. &lt;target name=&quot;cond-else&quot; depends=&quot;check-cond&quot; unless=&quot;cond-is-true&quot;&gt;
  1129. &lt;echo message=&quot;no&quot;/&gt;
  1130. &lt;/target&gt;
  1131. </pre></td>
  1132. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1133. </tr>
  1134. <tr>
  1135. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1136. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1137. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1138. </tr>
  1139. </table>
  1140. </div>
  1141. <p>This version takes advantage of two things:</p>
  1142. <ul>
  1143. <li>If a property <code>a</code> has not been set,
  1144. <code>${a}</code> will evaluate to <code>${a}</code>.</li>
  1145. <li>To get a literal <code>$</code> in Ant, you have to
  1146. escape it with another <code>$</code> - this will also break
  1147. the special treatment of the <code>${</code> sequence.</li>
  1148. </ul>
  1149. <p>Because testing for a literal <code>${property}</code> string
  1150. isn't all that readable or easy to understand,
  1151. post-1.4.1 Ant introduces the <code>&lt;isset&gt;</code> element
  1152. to the <code>&lt;condition&gt;</code> task.</p>
  1153. <p>Here is the previous example done using
  1154. <code>&lt;isset&gt;</code>:</p>
  1155. <div align="left">
  1156. <table cellspacing="4" cellpadding="0" border="0">
  1157. <tr>
  1158. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1159. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1160. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1161. </tr>
  1162. <tr>
  1163. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1164. <td bgcolor="#ffffff"><pre>
  1165. &lt;target name=&quot;check-cond&quot;&gt;
  1166. &lt;condition property=&quot;cond-is-true&quot;&gt;
  1167. &lt;and&gt;
  1168. &lt;isset property=&quot;prop1&quot;/&gt;
  1169. &lt;isset property=&quot;prop2&quot;/&gt;
  1170. &lt;not&gt;
  1171. &lt;isset property=&quot;prop3&quot;/&gt;
  1172. &lt;/not&gt;
  1173. &lt;/and&gt;
  1174. &lt;/condition&gt;
  1175. &lt;/target&gt;
  1176. </pre></td>
  1177. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1178. </tr>
  1179. <tr>
  1180. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1181. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1182. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1183. </tr>
  1184. </table>
  1185. </div>
  1186. <p>The last option is to use a scripting language to set the
  1187. properties. This can be particularly handy when you need much
  1188. finer control than the simple conditions shown here but, of
  1189. course, comes with the overhead of adding JAR files to support
  1190. the language, to say nothing of the added maintenance in requiring
  1191. two languages to implement a single system. See the
  1192. <a href="manual/OptionalTasks/script.html">
  1193. <code>&lt;script&gt;</code> task documentation</a> for more
  1194. details.</p>
  1195. </blockquote>
  1196. </td></tr>
  1197. </table>
  1198. </a>
  1199. <a name="stop-dependency">
  1200. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  1201. <tr><td bgcolor="#828DA6">
  1202. <font color="#ffffff" face="arial,helvetica,sanserif">
  1203. <strong>
  1204. I have a target I want to skip if a property is set,
  1205. so I have <code>unless="property"</code> as an attribute
  1206. of the target, but all the targets this target
  1207. depends on are still executed. Why?
  1208. </strong>
  1209. </font>
  1210. </td></tr>
  1211. <tr><td>
  1212. <blockquote>
  1213. <p>The list of dependencies is generated by Ant before any of the
  1214. targets are run. This allows dependent targets, such as an
  1215. <code>init</code> target, to set properties that can control the
  1216. execution of the targets higher in the dependency graph. This
  1217. is a good thing.</p>
  1218. <p>However, when your dependencies break down the
  1219. higher-level task
  1220. into several smaller steps, this behaviour becomes
  1221. counter-intuitive. There are a couple of solutions available:
  1222. </p>
  1223. <ol>
  1224. <li>Put the same condition on each of the dependent targets.</li>
  1225. <li>Execute the steps using <code>&lt;antcall&gt;</code>,
  1226. instead of specifying them inside the <code>depends</code>
  1227. attribute.</li>
  1228. </ol>
  1229. </blockquote>
  1230. </td></tr>
  1231. </table>
  1232. </a>
  1233. <a name="include-order">
  1234. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  1235. <tr><td bgcolor="#828DA6">
  1236. <font color="#ffffff" face="arial,helvetica,sanserif">
  1237. <strong>
  1238. In my <code>&lt;fileset&gt;</code>, I've put in an
  1239. <code>&lt;exclude&gt;</code> of all files followed by an
  1240. <code>&lt;include&gt;</code> of just the files I want, but it
  1241. isn't giving me any files at all. What's wrong?
  1242. </strong>
  1243. </font>
  1244. </td></tr>
  1245. <tr><td>
  1246. <blockquote>
  1247. <p>The order of the <code>&lt;include&gt;</code> and
  1248. <code>&lt;exclude&gt;</code> tags within a <code>&lt;fileset&gt;</code>
  1249. is ignored when the FileSet is created. Instead, all of the
  1250. <code>&lt;include&gt;</code> elements are processed together,
  1251. followed by all of the <code>&lt;exclude&gt;</code>
  1252. elements. This means that the <code>&lt;exclude&gt;</code>
  1253. elements only apply to the file list produced by the
  1254. <code>&lt;include&gt;</code> elements.</p>
  1255. <p>To get the files you want, focus on just the
  1256. <code>&lt;include&gt;</code> patterns that would be necessary
  1257. to get them. If you find you need to trim the list that the
  1258. <code>&lt;include&gt;</code> elements
  1259. produce, then use <code>&lt;exclude&gt;</code> elements.</p>
  1260. </blockquote>
  1261. </td></tr>
  1262. </table>
  1263. </a>
  1264. <a name="encoding">
  1265. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  1266. <tr><td bgcolor="#828DA6">
  1267. <font color="#ffffff" face="arial,helvetica,sanserif">
  1268. <strong>
  1269. How can I include national characters like German
  1270. umlauts in my build file?
  1271. </strong>
  1272. </font>
  1273. </td></tr>
  1274. <tr><td>
  1275. <blockquote>
  1276. <p>You need to tell the XML parser which character encoding
  1277. your build file uses, this is done inside the <a href="http://www.w3.org/TR/2000/REC-xml-20001006#sec-prolog-dtd">XML
  1278. declaration</a>.</p>
  1279. <p>By default the parser assumes you are using the UTF-8
  1280. encoding instead of your platform's default. For most Western
  1281. European countries you should set the encoding to
  1282. <code>ISO-8859-1</code>. To do so, make the very first line
  1283. of you build file read like</p>
  1284. <div align="left">
  1285. <table cellspacing="4" cellpadding="0" border="0">
  1286. <tr>
  1287. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1288. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1289. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1290. </tr>
  1291. <tr>
  1292. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1293. <td bgcolor="#ffffff"><pre>
  1294. &lt;?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot; ?&gt;
  1295. </pre></td>
  1296. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1297. </tr>
  1298. <tr>
  1299. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1300. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1301. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1302. </tr>
  1303. </table>
  1304. </div>
  1305. </blockquote>
  1306. </td></tr>
  1307. </table>
  1308. </a>
  1309. <a name="integration">
  1310. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  1311. <tr><td bgcolor="#828DA6">
  1312. <font color="#ffffff" face="arial,helvetica,sanserif">
  1313. <strong>
  1314. Is Ant supported by my IDE/Editor?
  1315. </strong>
  1316. </font>
  1317. </td></tr>
  1318. <tr><td>
  1319. <blockquote>
  1320. <p>See the <a href="external.html#IDE and Editor Integration">section
  1321. on IDE integration</a> on our External Tools and Tasks page.</p>
  1322. </blockquote>
  1323. </td></tr>
  1324. </table>
  1325. </a>
  1326. <a name="emacs-mode">
  1327. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  1328. <tr><td bgcolor="#828DA6">
  1329. <font color="#ffffff" face="arial,helvetica,sanserif">
  1330. <strong>
  1331. Why doesn't (X)Emacs/vi/MacOS X's project builder
  1332. correctly parse the error messages generated by Ant?
  1333. </strong>
  1334. </font>
  1335. </td></tr>
  1336. <tr><td>
  1337. <blockquote>
  1338. <p>Ant adds a "banner" with the name of the current
  1339. task in front of all logging messages - and there are no built-in
  1340. regular expressions in your editor that would account for
  1341. this.</p>
  1342. <p>You can disable this banner by invoking Ant with the
  1343. <code>-emacs</code> switch. To make Ant autodetect
  1344. Emacs' compile mode, put this into your
  1345. <code>.antrc</code> (contributed by Ville Skytt).</p>
  1346. <div align="left">
  1347. <table cellspacing="4" cellpadding="0" border="0">
  1348. <tr>
  1349. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1350. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1351. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1352. </tr>
  1353. <tr>
  1354. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1355. <td bgcolor="#ffffff"><pre>
  1356. # Detect (X)Emacs compile mode
  1357. if [ &quot;$EMACS&quot; = &quot;t&quot; ] ; then
  1358. ANT_ARGS=&quot;$ANT_ARGS -emacs&quot;
  1359. ANT_OPTS=&quot;$ANT_OPTS -Dbuild.compiler.emacs=true&quot;
  1360. fi
  1361. </pre></td>
  1362. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1363. </tr>
  1364. <tr>
  1365. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1366. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1367. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1368. </tr>
  1369. </table>
  1370. </div>
  1371. <p>Alternatively, you can add the following snippet to your
  1372. <code>.emacs</code> to make Emacs understand Ant's
  1373. output.</p>
  1374. <div align="left">
  1375. <table cellspacing="4" cellpadding="0" border="0">
  1376. <tr>
  1377. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1378. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1379. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1380. </tr>
  1381. <tr>
  1382. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1383. <td bgcolor="#ffffff"><pre>
  1384. (require 'compile)
  1385. (setq compilation-error-regexp-alist
  1386. (append (list
  1387. ;; works for jikes
  1388. '(&quot;^\\s-*\\[[^]]*\\]\\s-*\\(.+\\):\\([0-9]+\\):\\([0-9]+\\):[0-9]+:[0-9]+:&quot; 1 2 3)
  1389. ;; works for javac
  1390. '(&quot;^\\s-*\\[[^]]*\\]\\s-*\\(.+\\):\\([0-9]+\\):&quot; 1 2))
  1391. compilation-error-regexp-alist))
  1392. </pre></td>
  1393. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1394. </tr>
  1395. <tr>
  1396. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1397. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1398. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1399. </tr>
  1400. </table>
  1401. </div>
  1402. <p>Yet another alternative that preserves most of Ant's
  1403. formatting is to pipe Ant's output through the following Perl
  1404. script by Dirk-Willem van Gulik:</p>
  1405. <div align="left">
  1406. <table cellspacing="4" cellpadding="0" border="0">
  1407. <tr>
  1408. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1409. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1410. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1411. </tr>
  1412. <tr>
  1413. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1414. <td bgcolor="#ffffff"><pre>
  1415. #!/usr/bin/perl
  1416. #
  1417. # May 2001 dirkx@apache.org - remove any
  1418. # [foo] lines from the output; keeping
  1419. # spacing more or less there.
  1420. #
  1421. $|=1;
  1422. while(&lt;STDIN&gt;) {
  1423. if (s/^(\s+)\[(\w+)\]//) {
  1424. if ($2 ne $last) {
  1425. print &quot;$1\[$2\]&quot;;
  1426. $s = ' ' x length($2);
  1427. } else {
  1428. print &quot;$1 $s &quot;;
  1429. };
  1430. $last = $2;
  1431. };
  1432. print;
  1433. };
  1434. </pre></td>
  1435. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1436. </tr>
  1437. <tr>
  1438. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1439. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1440. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1441. </tr>
  1442. </table>
  1443. </div>
  1444. </blockquote>
  1445. </td></tr>
  1446. </table>
  1447. </a>
  1448. <a name="dtd">
  1449. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  1450. <tr><td bgcolor="#828DA6">
  1451. <font color="#ffffff" face="arial,helvetica,sanserif">
  1452. <strong>
  1453. Is there a DTD that I can use to validate my build
  1454. files?
  1455. </strong>
  1456. </font>
  1457. </td></tr>
  1458. <tr><td>
  1459. <blockquote>
  1460. <p>An incomplete DTD can be created by the
  1461. <code>&lt;antstructure&gt;</code> task - but this one
  1462. has a few problems:</p>
  1463. <ul>
  1464. <li>It doesn't know about required attributes. Only
  1465. manual tweaking of this file can help here.</li>
  1466. <li>It is not complete - if you add new tasks via
  1467. <code>&lt;taskdef&gt;</code> it won't know about it. See
  1468. <a href="http://www.sdv.fr/pages/casa/html/ant-dtd.en.html">this
  1469. page</a> by Michel Casabianca for a solution to this
  1470. problem. Note that the DTD you can download at this page
  1471. is based on Ant 0.3.1.</li>
  1472. <li>It may even be an invalid DTD. As Ant allows tasks
  1473. writers to define arbitrary elements, name collisions will
  1474. happen quite frequently - if your version of Ant contains
  1475. the optional <code>&lt;test&gt;</code> and
  1476. <code>&lt;junit&gt;</code> tasks, there are two XML
  1477. elements named <code>test</code> (the task and the nested child
  1478. element of <code>&lt;junit&gt;</code>) with different attribute
  1479. lists. This problem cannot be solved; DTDs don't give a
  1480. syntax rich enough to support this.</li>
  1481. </ul>
  1482. </blockquote>
  1483. </td></tr>
  1484. </table>
  1485. </a>
  1486. <a name="xml-entity-include">
  1487. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  1488. <tr><td bgcolor="#828DA6">
  1489. <font color="#ffffff" face="arial,helvetica,sanserif">
  1490. <strong>
  1491. How do I include an XML snippet in my build file?
  1492. </strong>
  1493. </font>
  1494. </td></tr>
  1495. <tr><td>
  1496. <blockquote>
  1497. <p>You can use XML's way of including external files and let
  1498. the parser do the job for Ant:</p>
  1499. <div align="left">
  1500. <table cellspacing="4" cellpadding="0" border="0">
  1501. <tr>
  1502. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1503. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1504. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1505. </tr>
  1506. <tr>
  1507. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1508. <td bgcolor="#ffffff"><pre>
  1509. &lt;?xml version=&quot;1.0&quot;?&gt;
  1510. &lt;!DOCTYPE project [
  1511. &lt;!ENTITY common SYSTEM &quot;file:./common.xml&quot;&gt;
  1512. ]&gt;
  1513. &lt;project name=&quot;test&quot; default=&quot;test&quot; basedir=&quot;.&quot;&gt;
  1514. &lt;target name=&quot;setup&quot;&gt;
  1515. ...
  1516. &lt;/target&gt;
  1517. &amp;common;
  1518. ...
  1519. &lt;/project&gt;
  1520. </pre></td>
  1521. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1522. </tr>
  1523. <tr>
  1524. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1525. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1526. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1527. </tr>
  1528. </table>
  1529. </div>
  1530. <p>will literally include the contents of <code>common.xml</code> where
  1531. you've placed the <code>&amp;common;</code> entity.</p>
  1532. <p>In combination with a DTD, this would look like this:</p>
  1533. <div align="left">
  1534. <table cellspacing="4" cellpadding="0" border="0">
  1535. <tr>
  1536. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1537. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1538. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1539. </tr>
  1540. <tr>
  1541. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1542. <td bgcolor="#ffffff"><pre>
  1543. &lt;!DOCTYPE project PUBLIC &quot;-//ANT//DTD project//EN&quot; &quot;file:./ant.dtd&quot; [
  1544. &lt;!ENTITY include SYSTEM &quot;file:./header.xml&quot;&gt;
  1545. ]&gt;
  1546. </pre></td>
  1547. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1548. </tr>
  1549. <tr>
  1550. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1551. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1552. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1553. </tr>
  1554. </table>
  1555. </div>
  1556. </blockquote>
  1557. </td></tr>
  1558. </table>
  1559. </a>
  1560. <a name="mail-logger">
  1561. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  1562. <tr><td bgcolor="#828DA6">
  1563. <font color="#ffffff" face="arial,helvetica,sanserif">
  1564. <strong>
  1565. How do I send an email with the result of my build
  1566. process?
  1567. </strong>
  1568. </font>
  1569. </td></tr>
  1570. <tr><td>
  1571. <blockquote>
  1572. <p>If you are using a nightly build of Ant 1.5 after
  1573. 2001-12-14, you can use the built-in MailLogger:</p>
  1574. <div align="left">
  1575. <table cellspacing="4" cellpadding="0" border="0">
  1576. <tr>
  1577. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1578. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1579. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1580. </tr>
  1581. <tr>
  1582. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1583. <td bgcolor="#ffffff"><pre>
  1584. ant -logger org.apache.tools.ant.listener.MailLogger
  1585. </pre></td>
  1586. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1587. </tr>
  1588. <tr>
  1589. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1590. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1591. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1592. </tr>
  1593. </table>
  1594. </div>
  1595. <p>See the <a href="http://cvs.apache.org/viewcvs/~checkout~/jakarta-ant/docs/manual/listeners.html?content-type=text/html">Listeners
  1596. &amp; Loggers</a> documentation for details on the properties
  1597. required.</p>
  1598. <p>For older versions of Ant, you can use a custom
  1599. BuildListener that sends out an email
  1600. in the buildFinished() method. Will Glozer
  1601. &lt;will.glozer@jda.com&gt; has written such a listener based
  1602. on <a href="http://java.sun.com/products/javamail/">JavaMail</a>.
  1603. The source is:</p>
  1604. <div align="left">
  1605. <table cellspacing="4" cellpadding="0" border="0">
  1606. <tr>
  1607. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1608. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1609. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1610. </tr>
  1611. <tr>
  1612. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1613. <td bgcolor="#ffffff"><pre>
  1614. import java.io.*;
  1615. import java.util.*;
  1616. import javax.mail.*;
  1617. import javax.mail.internet.*;
  1618. import org.apache.tools.ant.*;
  1619. /**
  1620. * A simple listener that waits for a build to finish and sends an email
  1621. * of the results. The settings are stored in &quot;monitor.properties&quot; and
  1622. * are fairly self explanatory.
  1623. *
  1624. * @author Will Glozer
  1625. * @version 1.05a 09/06/2000
  1626. */
  1627. public class BuildMonitor implements BuildListener {
  1628. protected Properties props;
  1629. /**
  1630. * Create a new BuildMonitor.
  1631. */
  1632. public BuildMonitor() throws Exception {
  1633. props = new Properties();
  1634. InputStream is = getClass().getResourceAsStream(&quot;monitor.properties&quot;);
  1635. props.load(is);
  1636. is.close();
  1637. }
  1638. public void buildStarted(BuildEvent e) {
  1639. }
  1640. /**
  1641. * Determine the status of the build and the actions to follow, now that
  1642. * the build has completed.
  1643. *
  1644. * @param e Event describing the build status.
  1645. */
  1646. public void buildFinished(BuildEvent e) {
  1647. Throwable th = e.getException();
  1648. String status = (th != null) ? &quot;failed&quot; : &quot;succeeded&quot;;
  1649. try {
  1650. String key = &quot;build.&quot; + status;
  1651. if (props.getProperty(key + &quot;.notify&quot;).equalsIgnoreCase(&quot;false&quot;)) {
  1652. return;
  1653. }
  1654. Session session = Session.getDefaultInstance(props, null);
  1655. MimeMessage message = new MimeMessage(session);
  1656. message.addRecipients(Message.RecipientType.TO, parseAddresses(
  1657. props.getProperty(key + &quot;.email.to&quot;)));
  1658. message.setSubject(props.getProperty(key + &quot;.email.subject&quot;));
  1659. BufferedReader br = new BufferedReader(new FileReader(
  1660. props.getProperty(&quot;build.log&quot;)));
  1661. StringWriter sw = new StringWriter();
  1662. String line = br.readLine();
  1663. while (line != null) {
  1664. sw.write(line);
  1665. sw.write(&quot;\n&quot;);
  1666. line = br.readLine();
  1667. }
  1668. br.close();
  1669. message.setText(sw.toString(), &quot;UTF-8&quot;);
  1670. sw.close();
  1671. Transport transport = session.getTransport();
  1672. transport.connect();
  1673. transport.send(message);
  1674. transport.close();
  1675. } catch (Exception ex) {
  1676. System.out.println(&quot;BuildMonitor failed to send email!&quot;);
  1677. ex.printStackTrace();
  1678. }
  1679. }
  1680. /**
  1681. * Parse a comma separated list of internet email addresses.
  1682. *
  1683. * @param s The list of addresses.
  1684. * @return Array of Addresses.
  1685. */
  1686. protected Address[] parseAddresses(String s) throws Exception {
  1687. StringTokenizer st = new StringTokenizer(s, &quot;,&quot;);
  1688. Address[] addrs = new Address[st.countTokens()];
  1689. for (int i = 0; i &lt; addrs.length; i++) {
  1690. addrs[i] = new InternetAddress(st.nextToken());
  1691. }
  1692. return addrs;
  1693. }
  1694. public void messageLogged(BuildEvent e) {
  1695. }
  1696. public void targetStarted(BuildEvent e) {
  1697. }
  1698. public void targetFinished(BuildEvent e) {
  1699. }
  1700. public void taskStarted(BuildEvent e) {
  1701. }
  1702. public void taskFinished(BuildEvent e) {
  1703. }
  1704. }
  1705. </pre></td>
  1706. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1707. </tr>
  1708. <tr>
  1709. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1710. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1711. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1712. </tr>
  1713. </table>
  1714. </div>
  1715. <p>With a <code>monitor.properties</code> like this:</p>
  1716. <div align="left">
  1717. <table cellspacing="4" cellpadding="0" border="0">
  1718. <tr>
  1719. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1720. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1721. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1722. </tr>
  1723. <tr>
  1724. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1725. <td bgcolor="#ffffff"><pre>
  1726. # configuration for build monitor
  1727. mail.transport.protocol=smtp
  1728. mail.smtp.host=&lt;host&gt;
  1729. mail.from=Will Glozer &lt;will.glozer@jda.com&gt;
  1730. build.log=build.log
  1731. build.failed.notify=true
  1732. build.failed.email.to=will.glozer@jda.com
  1733. build.failed.email.subject=Nightly build failed!
  1734. build.succeeded.notify=true
  1735. build.succeeded.email.to=will.glozer@jda.com
  1736. build.succeeded.email.subject=Nightly build succeeded!
  1737. </pre></td>
  1738. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1739. </tr>
  1740. <tr>
  1741. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1742. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1743. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1744. </tr>
  1745. </table>
  1746. </div>
  1747. <p><code>monitor.properties</code> should be placed right next
  1748. to your compiled <code>BuildMonitor.class</code>. To use it,
  1749. invoke Ant like:</p>
  1750. <div align="left">
  1751. <table cellspacing="4" cellpadding="0" border="0">
  1752. <tr>
  1753. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1754. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1755. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1756. </tr>
  1757. <tr>
  1758. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1759. <td bgcolor="#ffffff"><pre>
  1760. ant -listener BuildMonitor -logfile build.log
  1761. </pre></td>
  1762. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1763. </tr>
  1764. <tr>
  1765. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1766. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1767. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1768. </tr>
  1769. </table>
  1770. </div>
  1771. <p>Make sure that <code>mail.jar</code> from JavaMail and
  1772. <code>activation.jar</code> from the
  1773. <a href="http://java.sun.com/products/javabeans/glasgow/jaf.html">Java
  1774. Beans Activation Framework</a> are in your <code>CLASSPATH</code>.</p>
  1775. </blockquote>
  1776. </td></tr>
  1777. </table>
  1778. </a>
  1779. <a name="listener-properties">
  1780. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  1781. <tr><td bgcolor="#828DA6">
  1782. <font color="#ffffff" face="arial,helvetica,sanserif">
  1783. <strong>
  1784. How do I get at the properties that Ant was running
  1785. with from inside BuildListener?
  1786. </strong>
  1787. </font>
  1788. </td></tr>
  1789. <tr><td>
  1790. <blockquote>
  1791. <p>You can get at a hashtable with all the properties that Ant
  1792. has been using through the BuildEvent parameter. For
  1793. example:</p>
  1794. <div align="left">
  1795. <table cellspacing="4" cellpadding="0" border="0">
  1796. <tr>
  1797. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1798. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1799. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1800. </tr>
  1801. <tr>
  1802. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1803. <td bgcolor="#ffffff"><pre>
  1804. public void buildFinished(BuildEvent e) {
  1805. Hashtable table = e.getProject().getProperties();
  1806. String buildpath = (String)table.get(&quot;build.path&quot;);
  1807. ...
  1808. }
  1809. </pre></td>
  1810. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1811. </tr>
  1812. <tr>
  1813. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1814. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1815. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1816. </tr>
  1817. </table>
  1818. </div>
  1819. <p>This is more accurate than just reading the same property
  1820. files that your project does, since it will give the correct
  1821. results for properties that were specified on the Ant command line.</p>
  1822. </blockquote>
  1823. </td></tr>
  1824. </table>
  1825. </a>
  1826. <a name="remove-cr">
  1827. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  1828. <tr><td bgcolor="#828DA6">
  1829. <font color="#ffffff" face="arial,helvetica,sanserif">
  1830. <strong>
  1831. &lt;chmod&gt; or &lt;exec&gt; doesn't work in Ant
  1832. 1.3 on Unix
  1833. </strong>
  1834. </font>
  1835. </td></tr>
  1836. <tr><td>
  1837. <blockquote>
  1838. <p>The <code>antRun</code> script in <code>ANT_HOME/bin</code>
  1839. has DOS instead of Unix line endings; you must remove the
  1840. carriage-return characters from this file. This can be done by
  1841. using Ant's <code>&lt;fixcrlf&gt;</code> task
  1842. or something like:</p>
  1843. <div align="left">
  1844. <table cellspacing="4" cellpadding="0" border="0">
  1845. <tr>
  1846. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1847. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1848. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1849. </tr>
  1850. <tr>
  1851. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1852. <td bgcolor="#ffffff"><pre>
  1853. tr -d '\r' &lt; $ANT_HOME/bin/antRun &gt; /tmp/foo
  1854. mv /tmp/foo $ANT_HOME/bin/antRun
  1855. </pre></td>
  1856. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1857. </tr>
  1858. <tr>
  1859. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1860. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1861. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  1862. </tr>
  1863. </table>
  1864. </div>
  1865. </blockquote>
  1866. </td></tr>
  1867. </table>
  1868. </a>
  1869. <a name="javadoc-cannot-execute">
  1870. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  1871. <tr><td bgcolor="#828DA6">
  1872. <font color="#ffffff" face="arial,helvetica,sanserif">
  1873. <strong>
  1874. JavaDoc failed: java.io.IOException: javadoc: cannot execute
  1875. </strong>
  1876. </font>
  1877. </td></tr>
  1878. <tr><td>
  1879. <blockquote>
  1880. <p>There is a bug in the Solaris reference implementation of
  1881. the JDK (see <a href="http://developer.java.sun.com/developer/bugParade/bugs/4230399.html">http://developer.java.sun.com/developer/bugParade/bugs/4230399.html</a>).
  1882. This also appears to be true under Linux. Moving the JDK to
  1883. the front of the PATH fixes the problem.</p>
  1884. </blockquote>
  1885. </td></tr>
  1886. </table>
  1887. </a>
  1888. <a name="delegating-classloader">
  1889. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  1890. <tr><td bgcolor="#828DA6">
  1891. <font color="#ffffff" face="arial,helvetica,sanserif">
  1892. <strong>
  1893. &lt;style&gt; or &lt;junit&gt; ignores my
  1894. &lt;classpath&gt;
  1895. </strong>
  1896. </font>
  1897. </td></tr>
  1898. <tr><td>
  1899. <blockquote>
  1900. <p>These tasks don't ignore your classpath setting, you
  1901. are facing a common problem with delegating classloaders.</p>
  1902. <p>First of all let's state that Ant adds all
  1903. <code>.jar</code> files from <code>ANT_HOME/lib</code> to
  1904. <code>CLASSPATH</code>, therefore "in
  1905. <code>CLASSPATH</code>" shall mean "either in your
  1906. <code>CLASSPATH</code> environment variable or
  1907. <code>ANT_HOME/lib</code>" for the rest of this
  1908. answer.</p>
  1909. <p>This question collects a common type of problem: A task
  1910. needs an external library and it has a nested classpath
  1911. element so that you can point it to this external library, but
  1912. that doesn't work unless you put the external library into the
  1913. <code>CLASSPATH</code>.</p>
  1914. <p>The root of the problem is that the class that needs the
  1915. external library is on the <code>CLASSPATH</code>.</p>
  1916. <p>When you specify a nested <code>&lt;classpath&gt;</code> in
  1917. Ant, Ant creates a new class loader that uses the path you
  1918. have specified. It then tries to load additional classes from
  1919. this classloader.</p>
  1920. <p>In most cases - for example the two cases above - Ant
  1921. doesn't load the external library directly, it is the loaded
  1922. class that does so.</p>
  1923. <p>In the case of <code>&lt;junit&gt;</code> it is the task
  1924. implementation itself and in the case of
  1925. <code>&lt;style&gt;</code> it is the implementation of the
  1926. <code>org.apache.tools.ant.taskdefs.XSLTLiaison</code>
  1927. class.</p>
  1928. <p>Ant's class loader implementation uses Java's
  1929. delegation model, see <a href="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/ClassLoader.html">http://java.sun.com/products/jdk/1.2/docs/api/java/lang/ClassLoader.html</a>
  1930. the paragraph</p>
  1931. <blockquote>The <code>ClassLoader</code> class uses a
  1932. delegation model to search for classes and resources. Each
  1933. instance of <code>ClassLoader</code> has an associated parent
  1934. class loader. When called upon to find a class or resource, a
  1935. <code>ClassLoader</code> instance will delegate the search for
  1936. the class or resource to its parent class loader before
  1937. attempting to find the class or resource itself. The virtual
  1938. machine's built-in class loader, called the bootstrap
  1939. class loader, does not itself have a parent but may serve as
  1940. the parent of a <code>ClassLoader</code>
  1941. instance.</blockquote>
  1942. <p>This means, Ant's class loader will consult the
  1943. bootstrap class loader first, which tries to load classes from
  1944. <code>CLASSPATH</code>. The bootstrap class loader
  1945. doesn't know anything about Ant's class loader or
  1946. even the path you have specified.</p>
  1947. <p>If the bootstrap class loader can load the class Ant has
  1948. asked it to load, this class will try to load the external
  1949. library from <code>CLASSPATH</code> as well - it doesn't
  1950. know anything else - and will not find it unless the library
  1951. is in <code>CLASSPATH</code> as well.</p>
  1952. <p>To solve this, you have two major options:</p>
  1953. <ol>
  1954. <li>put all external libraries you need in
  1955. <code>CLASSPATH</code> as well this is not what you want,
  1956. otherwise you wouldn't have found this FAQ entry.</li>
  1957. <li>remove the class that loads the external library from
  1958. the <code>CLASSPATH</code>.</li>
  1959. </ol>
  1960. <p>The easiest way to do this is to remove
  1961. <code>optional.jar</code> from <code>ANT_HOME/lib</code>. If
  1962. you do so, you will have to <code>&lt;taskdef&gt;</code> all
  1963. optional tasks and use nested <code>&lt;classpath&gt;</code>
  1964. elements in the <code>&lt;taskdef&gt;</code> tasks that point
  1965. to the new location of <code>optional.jar</code>. Also,
  1966. don't forget to add the new location of
  1967. <code>optional.jar</code> to the
  1968. <code>&lt;classpath&gt;</code> of your
  1969. <code>&lt;style&gt;</code> or <code>&lt;junit&gt;</code>
  1970. task.</p>
  1971. <p>If you want to avoid to <code>&lt;taskdef&gt;</code> all
  1972. optional tasks you need, the only other option is to remove
  1973. the classes that should not be loaded via the bootstrap class
  1974. loader from <code>optional.jar</code> and put them into a
  1975. separate archive. Add this separate archive to the
  1976. <code>&lt;classpath&gt;</code> of your
  1977. <code>&lt;style&gt;</code> or <code>&lt;junit&gt;</code> task
  1978. - and make sure the separate archive is not in
  1979. <code>CLASSPATH</code>.</p>
  1980. <p>In the case of <code>&lt;junit&gt;</code> you'd have
  1981. to remove all classes that are in the
  1982. <code>org/apache/tools/ant/taskdefs/optional/junit</code>
  1983. directory, in the <code>&lt;style&gt;</code> case it is one of
  1984. the <code>*Liaison</code> classes in
  1985. <code>org/apache/tools/ant/taskdefs/optional</code>.</p>
  1986. <p>If you use the option to break up <code>optional.jar</code>
  1987. for <code>&lt;junit&gt;</code>, you still have to use a
  1988. <code>&lt;taskdef&gt;</code> with a nested
  1989. <code>&lt;classpath&gt;</code> to define the junit task.</p>
  1990. </blockquote>
  1991. </td></tr>
  1992. </table>
  1993. </a>
  1994. <a name="1.5-cygwin-sh">
  1995. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  1996. <tr><td bgcolor="#828DA6">
  1997. <font color="#ffffff" face="arial,helvetica,sanserif">
  1998. <strong>
  1999. The <code>ant</code> wrapper script of Ant 1.5 fails
  2000. for Cygwin if <code>ANT_HOME</code> is set to a Windows style
  2001. path.
  2002. </strong>
  2003. </font>
  2004. </td></tr>
  2005. <tr><td>
  2006. <blockquote>
  2007. <p>This problem has been reported only hours after Ant 1.5 has
  2008. been released, see <a href="http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10664">Bug
  2009. 10664</a> and all it's duplicates.</p>
  2010. <p>A fixed version of the wrapper script can be found <a href="http://jakarta.apache.org/builds/jakarta-ant/release/v1.5/errata/">here</a>.
  2011. Simply replace your script with this version.</p>
  2012. </blockquote>
  2013. </td></tr>
  2014. </table>
  2015. </a>
  2016. </blockquote>
  2017. </td></tr>
  2018. </table>
  2019. </td>
  2020. </tr>
  2021. <!-- FOOTER -->
  2022. <tr><td colspan="2">
  2023. <hr noshade="" size="1"/>
  2024. </td></tr>
  2025. <tr><td colspan="2">
  2026. <div align="center"><font color="#525D76" size="-1"><em>
  2027. Copyright &#169; 2000-2002, Apache Software Foundation
  2028. </em></font></div>
  2029. </td></tr>
  2030. </table>
  2031. </body>
  2032. </html>
  2033. <!-- end the processing -->