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.xml 47 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321
  1. <?xml version="1.0"?>
  2. <document>
  3. <properties>
  4. <author email="bodewig@apache.org">Stefan Bodewig</author>
  5. <title>Frequently Asked Questions</title>
  6. </properties>
  7. <faqsection title="About this FAQ">
  8. <faq id="latest-version">
  9. <question>Where do I find the latest version of this
  10. document?</question>
  11. <answer>
  12. <p>The latest version can always be found at Ant&apos;s homepage
  13. <a href="http://ant.apache.org/faq.html">http://ant.apache.org/faq.html</a>.</p>
  14. </answer>
  15. </faq>
  16. <faq id="adding-faqs">
  17. <question>How can I contribute to this FAQ?</question>
  18. <answer>
  19. <p>The page you are looking it is generated from
  20. <a href="http://cvs.apache.org/viewcvs.cgi/~checkout~/ant/xdocs/faq.xml">this</a>
  21. document. If you want to add a new question, please submit
  22. a patch against this document to one of Ant&apos;s mailing lists;
  23. hopefully, the structure is self-explanatory.</p>
  24. <p>If you don&apos;t know how to create a patch, see the patches
  25. section of <a href="http://jakarta.apache.org/site/source.html">this
  26. page</a>.</p>
  27. </answer>
  28. </faq>
  29. <faq id="creating-faq">
  30. <question>How do you create the HTML version of this
  31. FAQ?</question>
  32. <answer>
  33. <p>We use
  34. <a href="http://jakarta.apache.org/velocity/anakia.html">Anakia</a>
  35. to render the HTML version from the original XML file.</p>
  36. <p>The Velocity stylesheets used to process the XML files can
  37. be found in the <code>xdocs/stylesheets</code> subdirectory of
  38. Ant&apos;s CVS repository - the build file
  39. <code>docs.xml</code> at the top level of the ant CVS
  40. module is used to drive Anakia.</p>
  41. <p>This file assumes that you have the
  42. <code>jakarta-site2</code> CVS module checked out as well, but
  43. if you follow the instruction from Anakia&apos;s homepage, you
  44. should get it to work without that. Just make sure all
  45. required jars are in the task&apos;s classpath.</p>
  46. </answer>
  47. </faq>
  48. </faqsection>
  49. <faqsection title="General">
  50. <faq id="what-is-ant">
  51. <question>What is Apache Ant?</question>
  52. <answer>
  53. <p> Ant is a Java-based build tool. In theory, it is kind of
  54. like Make, without Make&apos;s wrinkles and with the full
  55. portability of pure Java code.</p>
  56. </answer>
  57. </faq>
  58. <faq id="ant-name">
  59. <question>Why do you call it Ant?</question>
  60. <answer>
  61. <p>According to Ant&apos;s original author, James Duncan
  62. Davidson, the name is an acronym for &quot;Another Neat
  63. Tool&quot;.</p>
  64. <p>Later explanations go along the lines of &quot;ants
  65. do an extremely good job at building things&quot;, or
  66. &quot;ants are very small and can carry a weight dozens of times
  67. their own&quot; - describing what Ant is intended to
  68. be.</p>
  69. </answer>
  70. </faq>
  71. <faq id="history">
  72. <question>Tell us a little bit about Ant&apos;s history.</question>
  73. <answer>
  74. <p>Initially, Ant was part of the Tomcat code base, when it was
  75. donated to the Apache Software Foundation. It was
  76. created by James Duncan Davidson, who is also the original
  77. author of Tomcat. Ant was there to build Tomcat, nothing
  78. else.</p>
  79. <p>Soon thereafter, several open source Java projects realized
  80. that Ant could solve the problems they had with Makefiles.
  81. Starting with the projects hosted at Jakarta and the old Java
  82. Apache project, Ant spread like a virus and is now the build
  83. tool of choice for a lot of projects.</p>
  84. <p>In January 2000, Ant was moved to a separate CVS module and
  85. was promoted to a project of its own, independent of
  86. Tomcat, and became Apache Ant.</p>
  87. <p>The first version of Ant that was exposed to a larger audience
  88. was the one that shipped with Tomcat&apos;s 3.1 release on 19 April
  89. 2000. This version has later been referred to as Ant
  90. 0.3.1.</p>
  91. <p>The first official release of Ant as a stand-alone product was
  92. Ant 1.1, released on 19 July 2000. The complete release
  93. history:</p>
  94. <table>
  95. <tr>
  96. <th>Ant Version</th>
  97. <th>Release Date</th>
  98. </tr>
  99. <tr>
  100. <td>1.1</td>
  101. <td>19 July 2000</td>
  102. </tr>
  103. <tr>
  104. <td>1.2</td>
  105. <td>24 October 2000</td>
  106. </tr>
  107. <tr>
  108. <td>1.3</td>
  109. <td>3 March 2001</td>
  110. </tr>
  111. <tr>
  112. <td>1.4</td>
  113. <td>3 September 2001</td>
  114. </tr>
  115. <tr>
  116. <td>1.4.1</td>
  117. <td>11 October 2001</td>
  118. </tr>
  119. <tr>
  120. <td>1.5</td>
  121. <td>10 July 2002</td>
  122. </tr>
  123. <tr>
  124. <td>1.5.1</td>
  125. <td>3 October 2002</td>
  126. </tr>
  127. <tr>
  128. <td>1.5.2</td>
  129. <td>3 March 2003</td>
  130. </tr>
  131. <tr>
  132. <td>1.5.3</td>
  133. <td>9 April 2003</td>
  134. </tr>
  135. <tr>
  136. <td>1.5.4</td>
  137. <td>12 August 2003</td>
  138. </tr>
  139. </table>
  140. </answer>
  141. </faq>
  142. </faqsection>
  143. <faqsection title="Installation">
  144. <faq id="no-gnu-tar">
  145. <question>I get checksum errors when I try to extract the
  146. <code>tar.gz</code> distribution file. Why?</question>
  147. <answer>
  148. <p>Ant&apos;s distribution contains file names that are longer
  149. than 100 characters, which is not supported by the standard
  150. tar file format. Several different implementations of tar use
  151. different and incompatible ways to work around this
  152. restriction.</p>
  153. <p>Ant&apos;s &lt;tar&gt; task can create tar archives that use
  154. the GNU tar extension, and this has been used when putting
  155. together the distribution. If you are using a different
  156. version of tar (for example, the one shipping with Solaris),
  157. you cannot use it to extract the archive.</p>
  158. <p>The solution is to either install GNU tar, which can be
  159. found <a href="http://www.gnu.org/software/tar/tar.html">here</a>,
  160. or use the zip archive instead (you can extract it using
  161. <code>jar xf</code>).</p>
  162. </answer>
  163. </faq>
  164. </faqsection>
  165. <faqsection title="How do I ...">
  166. <faq id="adding-external-tasks">
  167. <question>How do I add an external task that I&apos;ve written to the
  168. page &quot;External Tools and Task&quot;?</question>
  169. <answer>
  170. <p>Join and post a message to the dev or user mailing
  171. list (one list is enough), including the following
  172. information:</p>
  173. <ul>
  174. <li>the name of the task/tool</li>
  175. <li>a short description of the task/tool</li>
  176. <li>a Compatibility: entry stating with which version(s) of
  177. Ant the tool/task is compatible to</li>
  178. <li>a URL: entry linking to the main page of the tool/task</li>
  179. <li>a Contact: entry containing the email address or the URL
  180. of a webpage for the person or list to contact for issues
  181. related to the tool/task. <strong>Note that we&apos;ll add a
  182. link on the page, so any email address added there is not
  183. obfuscated and can (and probably will) be abused by robots
  184. harvesting websites for addresses to spam.</strong></li>
  185. <li>a License: entry containing the type of license for the
  186. tool/task</li>
  187. </ul>
  188. <p>The preferred format for this information is a patch to <a
  189. href="http://cvs.apache.org/viewcvs.cgi/~checkout~/ant/xdocs/external.xml">this</a>
  190. document.</p>
  191. </answer>
  192. </faq>
  193. <faq id="passing-cli-args">
  194. <question>How do I pass parameters from the command line to my
  195. build file?</question>
  196. <answer>
  197. <p>Use properties. Using <code>ant
  198. -D<em>name</em>=<em>value</em></code> lets you define values for
  199. properties on the Ant command line. These properties can then be
  200. used within your build file as
  201. any normal property: <code>${<em>name</em>}</code> will put in
  202. <code><em>value</em></code>.</p>
  203. </answer>
  204. </faq>
  205. <faq id="jikes-switches">
  206. <question>How can I use Jikes-specific command-line
  207. switches?</question>
  208. <answer>
  209. <p>A couple of switches are supported via &quot;magic&quot;
  210. properties:</p>
  211. <table>
  212. <tr>
  213. <th>switch</th>
  214. <th>property</th>
  215. <th>default</th>
  216. </tr>
  217. <tr>
  218. <td>+E</td>
  219. <td>build.compiler.emacs</td>
  220. <td>false == not set</td>
  221. </tr>
  222. <tr>
  223. <td>+P</td>
  224. <td>build.compiler.pedantic</td>
  225. <td>false == not set</td>
  226. </tr>
  227. <tr>
  228. <td>+F</td>
  229. <td>build.compiler.fulldepend</td>
  230. <td>false == not set</td>
  231. </tr>
  232. <tr>
  233. <td><strong>(Only for Ant &lt; 1.4; replaced by the
  234. <code><strong>nowarn</strong></code>
  235. attribute of the <code><strong>&lt;javac&gt;</strong></code>
  236. task after that.)</strong><br></br>-nowarn</td>
  237. <td>build.compiler.warnings</td>
  238. <td>true == not set</td>
  239. </tr>
  240. </table>
  241. <p>With Ant &gt;= 1.5, you can also use nested
  242. <code>&lt;compilerarg&gt;</code> elements with the
  243. <code>&lt;javac&gt;</code> task.</p>
  244. </answer>
  245. </faq>
  246. <faq id="shell-redirect-1">
  247. <question>How do I include a &lt; character in my command-line arguments?</question>
  248. <answer>
  249. <p>The short answer is "Use: <code>&amp;lt;</code>".</p>
  250. <p>The long answer is that this probably won&apos;t do what you
  251. want anyway (see <a href="#shell-redirect-2">the next
  252. section</a>).</p>
  253. </answer>
  254. </faq>
  255. <faq id="shell-redirect-2">
  256. <question>How do I redirect standard input or standard output
  257. in the <code>&lt;exec&gt;</code> task?</question>
  258. <answer>
  259. <p>Say you want to redirect the standard output stream of the
  260. <code>m4</code> command to write to a file, something
  261. like:</p>
  262. <source><![CDATA[
  263. shell-prompt> m4 foo.m4 > foo
  264. ]]></source>
  265. <p>and try to translate it into</p>
  266. <source><![CDATA[
  267. <exec executable="m4">
  268. <arg value="foo.m4"/>
  269. <arg value="&gt;"/>
  270. <arg value="foo"/>
  271. </exec>
  272. ]]></source>
  273. <p>This will not do what you expect. The output redirection is
  274. performed by your shell, not the command itself, so this
  275. should read:</p>
  276. <source><![CDATA[
  277. <exec executable="/bin/sh">
  278. <arg value="-c" />
  279. <arg value="m4 foo.m4 &gt; foo" />
  280. </exec>
  281. ]]></source>
  282. <p>Note that you must use the <code>value</code> attribute of
  283. <code>&lt;arg&gt;</code> in the last element, in order to have
  284. the command passed as a single, quoted argument. Alternatively,
  285. you can use:</p>
  286. <source><![CDATA[
  287. <exec executable="/bin/sh">
  288. <arg line='-c "m4 foo.m4 &gt; foo"'/>
  289. </exec>
  290. ]]></source>
  291. <p>Note the double-quotes nested inside the single-quotes.</p>
  292. </answer>
  293. </faq>
  294. <faq id="batch-shell-execute">
  295. <question>How do I execute a batch file or shell script from Ant?</question>
  296. <answer>
  297. <p>On native Unix systems, you should be able to run shell scripts
  298. directly. On systems running a Unix-type shell (for example, Cygwin
  299. on Windows) execute the (command) shell instead - <code>cmd</code>
  300. for batch files, <code>sh</code> for shell scripts - then pass the
  301. batch file or shell script (plus any arguments to the script)
  302. as a single command, using the <code>/c</code> or
  303. <code>-c</code> switch, respectively. See
  304. <a href="#shell-redirect-2">the above section</a>
  305. for example <code>&lt;exec&gt;</code> tasks
  306. executing <code>sh</code>. For batch files, use something like:</p>
  307. <source><![CDATA[
  308. <exec dir="." executable="cmd" os="Windows NT">
  309. <arg line="/c test.bat"/>
  310. </exec>
  311. ]]></source>
  312. </answer>
  313. </faq>
  314. <faq id="multi-conditions">
  315. <question>I want to execute a particular target only if
  316. multiple conditions are true.</question>
  317. <answer>
  318. <p>There are actually several answers to this question.</p>
  319. <p>If you have only one set and one unset property to test,
  320. you can specify both an <code>if</code> and an <code>unless</code>
  321. attribute for the target, and they will act as if they
  322. are &quot;anded&quot; together.</p>
  323. <p>If you are using a version of Ant 1.3 or earlier, the
  324. way to work with all other cases is to chain targets together
  325. to determine the specific state you want to test for.</p>
  326. <p>To see how this works, assume you have three properties:
  327. <code>prop1</code>, <code>prop2</code>, and <code>prop3</code>.
  328. You want to test that <code>prop1</code> and <code>prop2</code>
  329. are set, and that <code>prop3</code> is not. If the condition
  330. holds true you want to echo &quot;yes&quot;.</p>
  331. <p>Here is the implementation in Ant 1.3 and earlier:</p>
  332. <source><![CDATA[
  333. <target name="cond" depends="cond-if"/>
  334. <target name="cond-if" if="prop1">
  335. <antcall target="cond-if-2"/>
  336. </target>
  337. <target name="cond-if-2" if="prop2">
  338. <antcall target="cond-if-3"/>
  339. </target>
  340. <target name="cond-if-3" unless="prop3">
  341. <echo message="yes"/>
  342. </target>
  343. ]]></source>
  344. <p>Note: <code>&lt;antcall&gt;</code> tasks do <em>not</em> pass
  345. property changes back up to the environment they were called
  346. from, so you would&apos;nt be able to, for example, set a
  347. <code>result</code> property in the <code>cond-if-3</code> target,
  348. then do
  349. <code>&lt;echo message=&quot;result is ${result}&quot;/&gt;</code>
  350. in the <code>cond</code> target.</p>
  351. <p>Starting with Ant 1.4, you can use the
  352. <code>&lt;condition&gt;</code> task.</p>
  353. <source><![CDATA[
  354. <target name="cond" depends="cond-if,cond-else"/>
  355. <target name="check-cond">
  356. <condition property="cond-is-true">
  357. <and>
  358. <not>
  359. <equals arg1="${prop1}" arg2="$${prop1}" />
  360. </not>
  361. <not>
  362. <equals arg1="${prop2}" arg2="$${prop2}" />
  363. </not>
  364. <equals arg1="${prop3}" arg2="$${prop3}" />
  365. </and>
  366. </condition>
  367. </target>
  368. <target name="cond-if" depends="check-cond" if="cond-is-true">
  369. <echo message="yes"/>
  370. </target>
  371. <target name="cond-else" depends="check-cond" unless="cond-is-true">
  372. <echo message="no"/>
  373. </target>
  374. ]]></source>
  375. <p>This version takes advantage of two things:</p>
  376. <ul>
  377. <li>If a property <code>a</code> has not been set,
  378. <code>${a}</code> will evaluate to <code>${a}</code>.</li>
  379. <li>To get a literal <code>$</code> in Ant, you have to
  380. escape it with another <code>$</code> - this will also break
  381. the special treatment of the <code>${</code> sequence.</li>
  382. </ul>
  383. <p>Because testing for a literal <code>${property}</code> string
  384. isn&apos;t all that readable or easy to understand,
  385. post-1.4.1 Ant introduces the <code>&lt;isset&gt;</code> element
  386. to the <code>&lt;condition&gt;</code> task.</p>
  387. <p>Here is the previous example done using
  388. <code>&lt;isset&gt;</code>:</p>
  389. <source><![CDATA[
  390. <target name="check-cond">
  391. <condition property="cond-is-true">
  392. <and>
  393. <isset property="prop1"/>
  394. <isset property="prop2"/>
  395. <not>
  396. <isset property="prop3"/>
  397. </not>
  398. </and>
  399. </condition>
  400. </target>
  401. ]]></source>
  402. <p>The last option is to use a scripting language to set the
  403. properties. This can be particularly handy when you need much
  404. finer control than the simple conditions shown here but, of
  405. course, comes with the overhead of adding JAR files to support
  406. the language, to say nothing of the added maintenance in requiring
  407. two languages to implement a single system. See the
  408. <a href="manual/OptionalTasks/script.html">
  409. <code>&lt;script&gt;</code> task documentation</a> for more
  410. details.</p>
  411. </answer>
  412. </faq>
  413. <faq id="encoding">
  414. <question>How can I include national characters like German
  415. umlauts in my build file?</question>
  416. <answer>
  417. <p>You need to tell the XML parser which character encoding
  418. your build file uses, this is done inside the <a
  419. href="http://www.w3.org/TR/2000/REC-xml-20001006#sec-prolog-dtd">XML
  420. declaration</a>.</p>
  421. <p>By default the parser assumes you are using the UTF-8
  422. encoding instead of your platform&apos;s default. For most Western
  423. European countries you should set the encoding to
  424. <code>ISO-8859-1</code>. To do so, make the very first line
  425. of you build file read like</p>
  426. <source><![CDATA[
  427. <?xml version="1.0" encoding="ISO-8859-1" ?>
  428. ]]></source>
  429. </answer>
  430. </faq>
  431. <faq if="use-zip-instead-of-jar">
  432. <question>How do I use <code>jar</code>&apos;s <code>M</code> switch?
  433. I don&apos;t want a MANIFEST.</question>
  434. <answer>
  435. <p>A JAR archive is a ZIP file, so if you don&apos;t want a
  436. MANIFEST you can simply use <code>&lt;zip&gt;</code>.</p>
  437. <p>If your filenames contain national characters you should
  438. know that Sun&apos;s <code>jar</code> utility like Ant&apos;s
  439. <code>&lt;jar&gt;</code> uses UFT8 to encode their names while
  440. <code>&lt;zip&gt;</code> uses your platforms default encoding.
  441. Use the encoding attribute of <code>&lt;zip&gt;</code> if
  442. necessary.</p>
  443. </answer>
  444. </faq>
  445. </faqsection>
  446. <faqsection title="It doesn&apos;t work (as expected)">
  447. <faq id="always-recompiles">
  448. <question>Why does Ant always recompile all my Java files?</question>
  449. <answer>
  450. <p>In order to find out which files should be compiled, Ant
  451. compares the timestamps of the source files to those of the
  452. resulting <code>.class</code> files. Opening all source files
  453. to find out which package they belong to would be very
  454. inefficient. Instead, Ant expects you to place your
  455. source files in a directory hierarchy that mirrors your
  456. package hierarchy and to point Ant to the root of this
  457. directory tree with the <code>srcdir</code> attribute.</p>
  458. <p>Say you have <code>&lt;javac srcdir=&quot;src&quot;
  459. destdir=&quot;dest&quot;/&gt;</code>. If Ant finds a file
  460. <code>src/a/b/C.java</code>, it expects it to be in package
  461. <code>a.b</code> so that the resulting <code>.class</code>
  462. file is going to be <code>dest/a/b/C.class</code>.</p>
  463. <p>If your source-tree directory structure does not match your
  464. package structure, Ant&apos;s heuristic won&apos;t work, and
  465. it will recompile classes that are up-to-date. Ant is not the
  466. only tool that expects a source-tree layout like this.</p>
  467. <p>If you have Java source files that aren&apos;t declared to
  468. be part of any package, you can still use the <code>&lt;javac&gt;</code>
  469. task to compile these files correctly - just set the
  470. <code>srcdir</code> and <code>destdir</code> attributes to
  471. the actual directory the source
  472. files live in and the directory the class files should go into,
  473. respectively.</p>
  474. </answer>
  475. </faq>
  476. <faq id="defaultexcludes">
  477. <question>I&apos;ve used a <code>&lt;delete&gt;</code> task to
  478. delete unwanted SourceSafe control files (CVS files, editor
  479. backup files, etc.), but it doesn&apos;t seem to work; the files
  480. never get deleted. What&apos;s wrong?</question>
  481. <answer>
  482. <p>This is probably happening because, by default, Ant excludes
  483. SourceSafe control files (<code>vssver.scc</code>) and certain other
  484. files from FileSets.</p>
  485. <p>Here&apos;s what you probably did:</p>
  486. <source><![CDATA[
  487. <delete>
  488. <fileset dir="${build.src}" includes="**/vssver.scc"/>
  489. </delete>
  490. ]]></source>
  491. <p>You need to switch off the default exclusions,
  492. and it will work:</p>
  493. <source><![CDATA[
  494. <delete>
  495. <fileset dir="${build.src}" includes="**/vssver.scc"
  496. defaultexcludes="no"/>
  497. </delete>
  498. ]]></source>
  499. <p>For a complete listing of the patterns that are excluded
  500. by default, see <a href="manual/dirtasks.html#defaultexcludes">the user
  501. manual</a>.</p>
  502. </answer>
  503. </faq>
  504. <faq id="stop-dependency">
  505. <question>I have a target I want to skip if a property is set,
  506. so I have <code>unless=&quot;property&quot;</code> as an attribute
  507. of the target, but all the targets this target
  508. depends on are still executed. Why?</question>
  509. <answer>
  510. <p>The list of dependencies is generated by Ant before any of the
  511. targets are run. This allows dependent targets, such as an
  512. <code>init</code> target, to set properties that can control the
  513. execution of the targets higher in the dependency graph. This
  514. is a good thing.</p>
  515. <p>However, when your dependencies break down the
  516. higher-level task
  517. into several smaller steps, this behaviour becomes
  518. counter-intuitive. There are a couple of solutions available:
  519. </p>
  520. <ol>
  521. <li>Put the same condition on each of the dependent targets.</li>
  522. <li>Execute the steps using <code>&lt;antcall&gt;</code>,
  523. instead of specifying them inside the <code>depends</code>
  524. attribute.</li>
  525. </ol>
  526. </answer>
  527. </faq>
  528. <faq id="include-order">
  529. <question>In my <code>&lt;fileset&gt;</code>, I&apos;ve put in an
  530. <code>&lt;exclude&gt;</code> of all files followed by an
  531. <code>&lt;include&gt;</code> of just the files I want, but it
  532. isn&apos;t giving me any files at all. What&apos;s wrong?
  533. </question>
  534. <answer>
  535. <p>The order of the <code>&lt;include&gt;</code> and
  536. <code>&lt;exclude&gt;</code> tags within a <code>&lt;fileset&gt;</code>
  537. is ignored when the FileSet is created. Instead, all of the
  538. <code>&lt;include&gt;</code> elements are processed together,
  539. followed by all of the <code>&lt;exclude&gt;</code>
  540. elements. This means that the <code>&lt;exclude&gt;</code>
  541. elements only apply to the file list produced by the
  542. <code>&lt;include&gt;</code> elements.</p>
  543. <p>To get the files you want, focus on just the
  544. <code>&lt;include&gt;</code> patterns that would be necessary
  545. to get them. If you find you need to trim the list that the
  546. <code>&lt;include&gt;</code> elements produce, then use
  547. <code>&lt;exclude&gt;</code> elements.</p>
  548. </answer>
  549. </faq>
  550. <faq id="properties-not-trimmed">
  551. <question><code>ant</code> failed to build my program via javac
  552. even when I put the needed jars in an external
  553. <code>build.properties</code> file and reference them by
  554. <code>pathelement</code> or <code>classpath refid</code>.</question>
  555. <answer>
  556. <p>When <code>ant</code> loads properties from an external
  557. file it dosn&apos;t touch the value of properties, trailing blanks
  558. will not be trimmed for example.</p>
  559. <p>If the value represents a file path, like a jar needed to
  560. compile, the task which requires the value, javac for example
  561. would fail to compile since it can&apos;t find the file due to
  562. trailing spaces.</p>
  563. </answer>
  564. </faq>
  565. <faq id="winzip-lies">
  566. <question>Ant creates WAR files with a lower-case
  567. <code>web-inf</code> or JAR files with a lower-case
  568. <code>meta-inf</code> directory.</question>
  569. <answer>
  570. <p>No it doesn&apos;t.</p>
  571. <p>You may have seen these lower-case directory names in
  572. WinZIP, but WinZIP is trying to be helpful (and fails). If
  573. WinZIP encounters a filename that is all upper-case, it
  574. assumes it has come from an old DOS box andchanges the case to
  575. all lower-case for you.</p>
  576. <p>If you extract (or just check) the archive with jar, you
  577. will see that the names have the correct case.</p>
  578. <p>With WinZIP (version 8.1 at least), this can be corrected in the
  579. configuration. In the Options/Configuration menu, in the View tab, General
  580. section, check the "Allow all upper case files names" box. The META-INF and
  581. WEB-INF will look correct.</p>
  582. </answer>
  583. </faq>
  584. </faqsection>
  585. <faqsection title="Ant and IDEs/Editors">
  586. <faq id="integration">
  587. <question>Is Ant supported by my IDE/Editor?</question>
  588. <answer>
  589. <p>See the <a href="external.html#IDE and Editor Integration">section
  590. on IDE integration</a> on our External Tools and Tasks page.</p>
  591. </answer>
  592. </faq>
  593. <faq id="emacs-mode">
  594. <question>Why doesn&apos;t (X)Emacs/vi/MacOS X&apos;s project builder
  595. correctly parse the error messages generated by Ant?</question>
  596. <answer>
  597. <p>Ant adds a &quot;banner&quot; with the name of the current
  598. task in front of all logging messages - and there are no built-in
  599. regular expressions in your editor that would account for
  600. this.</p>
  601. <p>You can disable this banner by invoking Ant with the
  602. <code>-emacs</code> switch. To make Ant autodetect
  603. Emacs&apos; compile mode, put this into your
  604. <code>.antrc</code> (contributed by Ville Skytt&#228;).</p>
  605. <source><![CDATA[
  606. # Detect (X)Emacs compile mode
  607. if [ "$EMACS" = "t" ] ; then
  608. ANT_ARGS="$ANT_ARGS -emacs"
  609. ANT_OPTS="$ANT_OPTS -Dbuild.compiler.emacs=true"
  610. fi
  611. ]]></source>
  612. <p>Alternatively, you can add the following snippet to your
  613. <code>.emacs</code> to make Emacs understand Ant&apos;s
  614. output.</p>
  615. <source><![CDATA[
  616. (require 'compile)
  617. (setq compilation-error-regexp-alist
  618. (append (list
  619. ;; works for jikes
  620. '("^\\s-*\\[[^]]*\\]\\s-*\\(.+\\):\\([0-9]+\\):\\([0-9]+\\):[0-9]+:[0-9]+:" 1 2 3)
  621. ;; works for javac
  622. '("^\\s-*\\[[^]]*\\]\\s-*\\(.+\\):\\([0-9]+\\):" 1 2))
  623. compilation-error-regexp-alist))
  624. ]]></source>
  625. <p>Yet another alternative that preserves most of Ant&apos;s
  626. formatting is to pipe Ant&apos;s output through the following Perl
  627. script by Dirk-Willem van Gulik:</p>
  628. <source><![CDATA[
  629. #!/usr/bin/perl
  630. #
  631. # May 2001 dirkx@apache.org - remove any
  632. # [foo] lines from the output; keeping
  633. # spacing more or less there.
  634. #
  635. $|=1;
  636. while(<STDIN>) {
  637. if (s/^(\s+)\[(\w+)\]//) {
  638. if ($2 ne $last) {
  639. print "$1\[$2\]";
  640. $s = ' ' x length($2);
  641. } else {
  642. print "$1 $s ";
  643. };
  644. $last = $2;
  645. };
  646. print;
  647. };
  648. ]]></source>
  649. </answer>
  650. </faq>
  651. </faqsection>
  652. <faqsection title="Advanced Issues">
  653. <faq id="dtd">
  654. <question>Is there a DTD that I can use to validate my build
  655. files?</question>
  656. <answer>
  657. <p>An incomplete DTD can be created by the
  658. <code>&lt;antstructure&gt;</code> task - but this one
  659. has a few problems:</p>
  660. <ul>
  661. <li>It doesn&apos;t know about required attributes. Only
  662. manual tweaking of this file can help here.</li>
  663. <li>It is not complete - if you add new tasks via
  664. <code>&lt;taskdef&gt;</code> it won&apos;t know about it. See
  665. <a href="http://www.sdv.fr/pages/casa/html/ant-dtd.en.html">this
  666. page</a> by Michel Casabianca for a solution to this
  667. problem. Note that the DTD you can download at this page
  668. is based on Ant 0.3.1.</li>
  669. <li>It may even be an invalid DTD. As Ant allows tasks
  670. writers to define arbitrary elements, name collisions will
  671. happen quite frequently - if your version of Ant contains
  672. the optional <code>&lt;test&gt;</code> and
  673. <code>&lt;junit&gt;</code> tasks, there are two XML
  674. elements named <code>test</code> (the task and the nested child
  675. element of <code>&lt;junit&gt;</code>) with different attribute
  676. lists. This problem cannot be solved; DTDs don&apos;t give a
  677. syntax rich enough to support this.</li>
  678. </ul>
  679. </answer>
  680. </faq>
  681. <faq id="xml-entity-include">
  682. <question>How do I include an XML snippet in my build file?</question>
  683. <answer>
  684. <p>You can use XML&apos;s way of including external files and let
  685. the parser do the job for Ant:</p>
  686. <source><![CDATA[
  687. <?xml version="1.0"?>
  688. <!DOCTYPE project [
  689. <!ENTITY common SYSTEM "file:./common.xml">
  690. ]>
  691. <project name="test" default="test" basedir=".">
  692. <target name="setup">
  693. ...
  694. </target>
  695. &common;
  696. ...
  697. </project>
  698. ]]></source>
  699. <p>will literally include the contents of <code>common.xml</code> where
  700. you&apos;ve placed the <code>&amp;common;</code> entity.</p>
  701. <p>In combination with a DTD, this would look like this:</p>
  702. <source><![CDATA[
  703. <!DOCTYPE project PUBLIC "-//ANT//DTD project//EN" "file:./ant.dtd" [
  704. <!ENTITY include SYSTEM "file:./header.xml">
  705. ]>
  706. ]]></source>
  707. <p>Starting with Ant 1.6, there is a new
  708. <code>&lt;import&gt;</code> task that can (also) be used to
  709. include build file fragments. Unlike the snippets used with
  710. entity includes, the referenced files have to be complete Ant
  711. build files, though.</p>
  712. <p>The example above would become:</p>
  713. <source><![CDATA[
  714. <?xml version="1.0"?>
  715. <project name="test" default="test" basedir=".">
  716. <target name="setup">
  717. ...
  718. </target>
  719. <import file="../common.xml"/>
  720. ...
  721. </project>
  722. ]]></source>
  723. <p>Unlike entity includes, <code>&lt;import&gt;</code> will
  724. let you use Ant properties in the file name.</p>
  725. </answer>
  726. </faq>
  727. <faq id="mail-logger">
  728. <question>How do I send an email with the result of my build
  729. process?</question>
  730. <answer>
  731. <p>If you are using a nightly build of Ant 1.5 after
  732. 2001-12-14, you can use the built-in MailLogger:</p>
  733. <source><![CDATA[
  734. ant -logger org.apache.tools.ant.listener.MailLogger
  735. ]]></source>
  736. <p>See the <a href="http://cvs.apache.org/viewcvs/~checkout~/ant/docs/manual/listeners.html?content-type=text/html">Listeners
  737. &amp; Loggers</a> documentation for details on the properties
  738. required.</p>
  739. <p>For older versions of Ant, you can use a custom
  740. BuildListener that sends out an email
  741. in the buildFinished() method. Will Glozer
  742. &lt;will.glozer@jda.com&gt; has written such a listener based
  743. on <a href="http://java.sun.com/products/javamail/">JavaMail</a>.
  744. The source is:</p>
  745. <source><![CDATA[
  746. import java.io.*;
  747. import java.util.*;
  748. import javax.mail.*;
  749. import javax.mail.internet.*;
  750. import org.apache.tools.ant.*;
  751. /**
  752. * A simple listener that waits for a build to finish and sends an email
  753. * of the results. The settings are stored in "monitor.properties" and
  754. * are fairly self explanatory.
  755. *
  756. * @author Will Glozer
  757. * @version 1.05a 09/06/2000
  758. */
  759. public class BuildMonitor implements BuildListener {
  760. protected Properties props;
  761. /**
  762. * Create a new BuildMonitor.
  763. */
  764. public BuildMonitor() throws Exception {
  765. props = new Properties();
  766. InputStream is = getClass().getResourceAsStream("monitor.properties");
  767. props.load(is);
  768. is.close();
  769. }
  770. public void buildStarted(BuildEvent e) {
  771. }
  772. /**
  773. * Determine the status of the build and the actions to follow, now that
  774. * the build has completed.
  775. *
  776. * @param e Event describing the build status.
  777. */
  778. public void buildFinished(BuildEvent e) {
  779. Throwable th = e.getException();
  780. String status = (th != null) ? "failed" : "succeeded";
  781. try {
  782. String key = "build." + status;
  783. if (props.getProperty(key + ".notify").equalsIgnoreCase("false")) {
  784. return;
  785. }
  786. Session session = Session.getDefaultInstance(props, null);
  787. MimeMessage message = new MimeMessage(session);
  788. message.addRecipients(Message.RecipientType.TO, parseAddresses(
  789. props.getProperty(key + ".email.to")));
  790. message.setSubject(props.getProperty(key + ".email.subject"));
  791. BufferedReader br = new BufferedReader(new FileReader(
  792. props.getProperty("build.log")));
  793. StringWriter sw = new StringWriter();
  794. String line = br.readLine();
  795. while (line != null) {
  796. sw.write(line);
  797. sw.write("\n");
  798. line = br.readLine();
  799. }
  800. br.close();
  801. message.setText(sw.toString(), "UTF-8");
  802. sw.close();
  803. Transport transport = session.getTransport();
  804. transport.connect();
  805. transport.send(message);
  806. transport.close();
  807. } catch (Exception ex) {
  808. System.out.println("BuildMonitor failed to send email!");
  809. ex.printStackTrace();
  810. }
  811. }
  812. /**
  813. * Parse a comma separated list of internet email addresses.
  814. *
  815. * @param s The list of addresses.
  816. * @return Array of Addresses.
  817. */
  818. protected Address[] parseAddresses(String s) throws Exception {
  819. StringTokenizer st = new StringTokenizer(s, ",");
  820. Address[] addrs = new Address[st.countTokens()];
  821. for (int i = 0; i < addrs.length; i++) {
  822. addrs[i] = new InternetAddress(st.nextToken());
  823. }
  824. return addrs;
  825. }
  826. public void messageLogged(BuildEvent e) {
  827. }
  828. public void targetStarted(BuildEvent e) {
  829. }
  830. public void targetFinished(BuildEvent e) {
  831. }
  832. public void taskStarted(BuildEvent e) {
  833. }
  834. public void taskFinished(BuildEvent e) {
  835. }
  836. }
  837. ]]></source>
  838. <p>With a <code>monitor.properties</code> like this:</p>
  839. <source><![CDATA[
  840. # configuration for build monitor
  841. mail.transport.protocol=smtp
  842. mail.smtp.host=<host>
  843. mail.from=Will Glozer <will.glozer@jda.com>
  844. build.log=build.log
  845. build.failed.notify=true
  846. build.failed.email.to=will.glozer@jda.com
  847. build.failed.email.subject=Nightly build failed!
  848. build.succeeded.notify=true
  849. build.succeeded.email.to=will.glozer@jda.com
  850. build.succeeded.email.subject=Nightly build succeeded!
  851. ]]></source>
  852. <p><code>monitor.properties</code> should be placed right next
  853. to your compiled <code>BuildMonitor.class</code>. To use it,
  854. invoke Ant like:</p>
  855. <source><![CDATA[
  856. ant -listener BuildMonitor -logfile build.log
  857. ]]></source>
  858. <p>Make sure that <code>mail.jar</code> from JavaMail and
  859. <code>activation.jar</code> from the
  860. <a href="http://java.sun.com/products/javabeans/glasgow/jaf.html">Java
  861. Beans Activation Framework</a> are in your <code>CLASSPATH</code>.</p>
  862. </answer>
  863. </faq>
  864. <faq id="listener-properties">
  865. <question>How do I get at the properties that Ant was running
  866. with from inside BuildListener?</question>
  867. <answer>
  868. <p>You can get at a hashtable with all the properties that Ant
  869. has been using through the BuildEvent parameter. For
  870. example:</p>
  871. <source><![CDATA[
  872. public void buildFinished(BuildEvent e) {
  873. Hashtable table = e.getProject().getProperties();
  874. String buildpath = (String)table.get("build.path");
  875. ...
  876. }
  877. ]]></source>
  878. <p>This is more accurate than just reading the same property
  879. files that your project does, since it will give the correct
  880. results for properties that were specified on the Ant command line.</p>
  881. </answer>
  882. </faq>
  883. </faqsection>
  884. <faqsection title="Known Problems">
  885. <faq id="remove-cr">
  886. <question>&lt;chmod&gt; or &lt;exec&gt; doesn&apos;t work in Ant
  887. 1.3 on Unix</question>
  888. <answer>
  889. <p>The <code>antRun</code> script in <code>ANT_HOME/bin</code>
  890. has DOS instead of Unix line endings; you must remove the
  891. carriage-return characters from this file. This can be done by
  892. using Ant&apos;s <code>&lt;fixcrlf&gt;</code> task
  893. or something like:</p>
  894. <source><![CDATA[
  895. tr -d '\r' < $ANT_HOME/bin/antRun > /tmp/foo
  896. mv /tmp/foo $ANT_HOME/bin/antRun
  897. ]]></source>
  898. </answer>
  899. </faq>
  900. <faq id="javadoc-cannot-execute">
  901. <question>JavaDoc failed: java.io.IOException: javadoc: cannot execute</question>
  902. <answer>
  903. <p>There is a bug in the Solaris reference implementation of
  904. 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>).
  905. This also appears to be true under Linux. Moving the JDK to
  906. the front of the PATH fixes the problem.</p>
  907. </answer>
  908. </faq>
  909. <faq id="delegating-classloader">
  910. <question>&lt;style&gt; or &lt;junit&gt; ignores my
  911. &lt;classpath&gt;</question>
  912. <answer>
  913. <p>These tasks don&apos;t ignore your classpath setting, you
  914. are facing a common problem with delegating classloaders.</p>
  915. <p>First of all let&apos;s state that Ant adds all
  916. <code>.jar</code> files from <code>ANT_HOME/lib</code> to
  917. <code>CLASSPATH</code>, therefore &quot;in
  918. <code>CLASSPATH</code>&quot; shall mean &quot;either in your
  919. <code>CLASSPATH</code> environment variable or
  920. <code>ANT_HOME/lib</code>&quot; for the rest of this
  921. answer.</p>
  922. <p>Technically the sentence above isn&apos;t true for Ant 1.6
  923. and later anymore, but the result is the same. For the sake
  924. of this discussion, <code>CLASSPATH</code> and
  925. <code>ANT_HOME/lib</code> are identical.</p>
  926. <p>This question collects a common type of problem: A task
  927. needs an external library and it has a nested classpath
  928. element so that you can point it to this external library, but
  929. that doesn&apos;t work unless you put the external library into the
  930. <code>CLASSPATH</code>.</p>
  931. <p>The root of the problem is that the class that needs the
  932. external library is on the <code>CLASSPATH</code>.</p>
  933. <p>When you specify a nested <code>&lt;classpath&gt;</code> in
  934. Ant, Ant creates a new class loader that uses the path you
  935. have specified. It then tries to load additional classes from
  936. this classloader.</p>
  937. <p>In most cases - for example the two cases above - Ant
  938. doesn&apos;t load the external library directly, it is the loaded
  939. class that does so.</p>
  940. <p>In the case of <code>&lt;junit&gt;</code> it is the task
  941. implementation itself and in the case of
  942. <code>&lt;style&gt;</code> it is the implementation of the
  943. <code>org.apache.tools.ant.taskdefs.XSLTLiaison</code>
  944. class.</p>
  945. <p>Ant&apos;s class loader implementation uses Java&apos;s
  946. delegation model, see <a
  947. 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>
  948. the paragraph</p>
  949. <blockquote>The <code>ClassLoader</code> class uses a
  950. delegation model to search for classes and resources. Each
  951. instance of <code>ClassLoader</code> has an associated parent
  952. class loader. When called upon to find a class or resource, a
  953. <code>ClassLoader</code> instance will delegate the search for
  954. the class or resource to its parent class loader before
  955. attempting to find the class or resource itself. The virtual
  956. machine&apos;s built-in class loader, called the bootstrap
  957. class loader, does not itself have a parent but may serve as
  958. the parent of a <code>ClassLoader</code>
  959. instance.</blockquote>
  960. <p>This means, Ant&apos;s class loader will consult the
  961. bootstrap class loader first, which tries to load classes from
  962. <code>CLASSPATH</code>. The bootstrap class loader
  963. doesn&apos;t know anything about Ant&apos;s class loader or
  964. even the path you have specified.</p>
  965. <p>If the bootstrap class loader can load the class Ant has
  966. asked it to load, this class will try to load the external
  967. library from <code>CLASSPATH</code> as well - it doesn&apos;t
  968. know anything else - and will not find it unless the library
  969. is in <code>CLASSPATH</code> as well.</p>
  970. <p>To solve this, you have two major options:</p>
  971. <ol>
  972. <li>put all external libraries you need in
  973. <code>CLASSPATH</code> as well this is not what you want,
  974. otherwise you wouldn&apos;t have found this FAQ entry.</li>
  975. <li>remove the class that loads the external library from
  976. the <code>CLASSPATH</code>.</li>
  977. </ol>
  978. <p><strong>Using The Second Option with Ant 1.5.4 and
  979. Earlier:</strong></p>
  980. <p>The easiest way to do this is to remove
  981. <code>optional.jar</code> from <code>ANT_HOME/lib</code>. If
  982. you do so, you will have to <code>&lt;taskdef&gt;</code> all
  983. optional tasks and use nested <code>&lt;classpath&gt;</code>
  984. elements in the <code>&lt;taskdef&gt;</code> tasks that point
  985. to the new location of <code>optional.jar</code>. Also,
  986. don&apos;t forget to add the new location of
  987. <code>optional.jar</code> to the
  988. <code>&lt;classpath&gt;</code> of your
  989. <code>&lt;style&gt;</code> or <code>&lt;junit&gt;</code>
  990. task.</p>
  991. <p>If you want to avoid to <code>&lt;taskdef&gt;</code> all
  992. optional tasks you need, the only other option is to remove
  993. the classes that should not be loaded via the bootstrap class
  994. loader from <code>optional.jar</code> and put them into a
  995. separate archive. Add this separate archive to the
  996. <code>&lt;classpath&gt;</code> of your
  997. <code>&lt;style&gt;</code> or <code>&lt;junit&gt;</code> task
  998. - and make sure the separate archive is not in
  999. <code>CLASSPATH</code>.</p>
  1000. <p>In the case of <code>&lt;junit&gt;</code> you&apos;d have
  1001. to remove all classes that are in the
  1002. <code>org/apache/tools/ant/taskdefs/optional/junit</code>
  1003. directory, in the <code>&lt;style&gt;</code> case it is one of
  1004. the <code>*Liaison</code> classes in
  1005. <code>org/apache/tools/ant/taskdefs/optional</code>.</p>
  1006. <p><strong>Using The Second Option with Ant 1.6 and
  1007. later:</strong></p>
  1008. <p>In Ant 1.6 <code>optional.jar</code> has been split into
  1009. multiple jars, each one containing classes with the same
  1010. dependencies on external libraries. You can move the
  1011. "offending" jar out of ANT_HOME/lib. For the
  1012. <code>&lt;junit&gt;</code> task it would be
  1013. <code>ant-junit.jar</code> and for <code>&lt;style&gt;</code>
  1014. it would be <code>ant-trax.jar</code>,
  1015. <code>ant-xalan1.jar</code> or <code>ant-xslp.jar</code> -
  1016. depending on the processor you use.</p>
  1017. <p>If you use the option to break up <code>optional.jar</code>
  1018. for <code>&lt;junit&gt;</code> or remove
  1019. <code>ant-junit.jar</code>, you still have to use a
  1020. <code>&lt;taskdef&gt;</code> with a nested
  1021. <code>&lt;classpath&gt;</code> to define the junit task.</p>
  1022. </answer>
  1023. </faq>
  1024. <faq id="winxp-jdk14-ant14">
  1025. <question>When running Ant 1.4 on Windows XP and JDK 1.4, I get
  1026. various errors when trying to <code>&lt;exec&gt;</code>, fork
  1027. <code>&lt;java&gt;</code> or access environment
  1028. variables.</question>
  1029. <answer>
  1030. <p>Ant &lt; 1.5 doesn&apos;t recognize Windows XP as a flavor
  1031. of Windows that runs <code>CMD.EXE</code> instead of
  1032. <code>COMMAND.COM</code>. JDK 1.3 will tell Ant that Windows
  1033. XP is Windows 2000 so the problem doesn&apos;t show up
  1034. there.</p>
  1035. <p>Apart from upgrading to Ant 1.5 or better, setting the
  1036. environment variable <code>ANT_OPTS</code> to
  1037. <code>-Dos.name=Windows_NT</code> prior to invoking Ant has
  1038. been confirmed as a workaround.</p>
  1039. </answer>
  1040. </faq>
  1041. <faq id="1.5-cygwin-sh">
  1042. <question>The <code>ant</code> wrapper script of Ant 1.5 fails
  1043. for Cygwin if <code>ANT_HOME</code> is set to a Windows style
  1044. path.</question>
  1045. <answer>
  1046. <p>This problem has been reported only hours after Ant 1.5 has
  1047. been released, see <a
  1048. href="http://issues.apache.org/bugzilla/show_bug.cgi?id=10664">Bug
  1049. 10664</a> and all its duplicates.</p>
  1050. <p>A fixed version of the wrapper script can be found <a
  1051. href="http://ant.apache.org/old-releases/v1.5/errata/">here</a>.
  1052. Simply replace your script with this version.</p>
  1053. </answer>
  1054. </faq>
  1055. <faq id="1.5.2-zip-broken">
  1056. <question><code>&lt;zip&gt;</code> is broken in Ant 1.5.2.</question>
  1057. <answer>
  1058. <p>Yes, it is.</p>
  1059. <p>The problem reported by most people - see <a
  1060. href="http://issues.apache.org/bugzilla/show_bug.cgi?id=17648">Bug
  1061. 17648</a> and all its duplicates - is that Ant creates
  1062. archives that a partially unreadable by WinZIP. Luckily
  1063. <code>jar</code> deals with the archives and so the generated
  1064. jars/wars/ears will most likely work for you anyway.</p>
  1065. <p>There are additional problems, see bugs <a
  1066. href="http://issues.apache.org/bugzilla/show_bug.cgi?id=17780">Bug
  1067. 17780</a>, <a
  1068. href="http://issues.apache.org/bugzilla/show_bug.cgi?id=17871">Bug
  1069. 17871</a> and <a
  1070. href="http://issues.apache.org/bugzilla/show_bug.cgi?id=18403">Bug
  1071. 18403</a>. All of them are supposed to be fixed with Ant
  1072. 1.5.3 (and only 18403 should exist in 1.5.3beta1).</p>
  1073. </answer>
  1074. </faq>
  1075. </faqsection>
  1076. </document>