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.

problems.html 19 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <!--
  3. Licensed to the Apache Software Foundation (ASF) under one or more
  4. contributor license agreements. See the NOTICE file distributed with
  5. this work for additional information regarding copyright ownership.
  6. The ASF licenses this file to You under the Apache License, Version 2.0
  7. (the "License"); you may not use this file except in compliance with
  8. the License. You may obtain a copy of the License at
  9. http://www.apache.org/licenses/LICENSE-2.0
  10. Unless required by applicable law or agreed to in writing, software
  11. distributed under the License is distributed on an "AS IS" BASIS,
  12. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. See the License for the specific language governing permissions and
  14. limitations under the License.
  15. -->
  16. <html lang="en">
  17. <!-- GENERATED FILE, DO NOT EDIT, EDIT THE XML FILE IN xdocs INSTEAD! -->
  18. <head>
  19. <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  20. <title>Apache Ant - Having Problems?</title>
  21. <link type="text/css" href="./page.css" rel="stylesheet">
  22. <meta name="author" content="Conor MacNeill">
  23. <meta name="email" content="">
  24. </head>
  25. <body>
  26. <p class="navpath">
  27. <script src="./breadcrumbs.js" language="JavaScript" type="text/javascript"></script>
  28. </p>
  29. <div class="logobar">
  30. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  31. <tr>
  32. <td align="left"><img border="0" alt="Apache Ant site" src="./images/group-logo.gif"></td>
  33. <td align="center" width="100%"><img alt="Apache Ant logo" border="0" src="./images/project-logo.gif"></td>
  34. <td align="right">
  35. <form target="_blank" onsubmit="q.value = query.value + ' site:ant.apache.org'" action="http://www.google.com/search" method="get">
  36. <table summary="search" border="0" cellspacing="0" cellpadding="0" bgcolor="#4C6C8F">
  37. <tr>
  38. <td colspan="3"><img height="10" width="1" alt="" src="./images/spacer.gif"></td>
  39. </tr>
  40. <tr>
  41. <td><img height="1" width="1" alt="" src="./images/spacer.gif"></td>
  42. <td nowrap="nowrap" class="searchcaption">
  43. <input name="q" type="hidden">
  44. <input size="15" id="query" type="text">
  45. <img height="1" width="5" alt="" src="./images/spacer.gif">
  46. <input name="Search" value="Search" type="submit">
  47. <br>
  48. the Apache Ant site
  49. </td>
  50. <td><img height="1" width="1" alt="" src="./images/spacer.gif"></td>
  51. </tr>
  52. <tr>
  53. <td><img alt="" border="0" height="10" width="9" src="./images/search-left.gif"></td>
  54. <td><img height="1" width="1" alt="" src="./images/spacer.gif"></td>
  55. <td><img alt="" border="0" height="10" width="9" src="./images/search-right.gif"></td>
  56. </tr>
  57. </table>
  58. </form>
  59. </td>
  60. </tr>
  61. </table>
  62. </div>
  63. <div class="tab">
  64. <table summary="tab bar" border="0" cellpadding="0" cellspacing="0">
  65. <tr>
  66. <td width="8"><img alt="" height="5" width="8" src="./images/spacer.gif"></td><td valign="bottom">
  67. <table summary="selected tab" style="height: 1.5em" border="0" cellpadding="0" cellspacing="0">
  68. <tr>
  69. <td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="./images/tabSel-left.gif"></td><td valign="middle" bgcolor="#4C6C8F"><font color="#ffffff" size="2" face="Arial, Helvetica, Sans-serif"><b>Home</b></font></td><td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="./images/tabSel-right.gif"></td>
  70. </tr>
  71. </table>
  72. </td>
  73. <td width="5"><img alt="" height="8" width="8" src="./images/spacer.gif"></td><td valign="bottom">
  74. <table summary="non selected tab" style="height: 1.4em" border="0" cellpadding="0" cellspacing="0">
  75. <tr>
  76. <td valign="top" width="5" bgcolor="#B2C4E0"><img height="5" width="5" alt="" src="./images/tab-left.gif"></td><td valign="middle" bgcolor="#B2C4E0"><a href="./projects/index.html"><font size="2" face="Arial, Helvetica, Sans-serif">Projects</font></a></td><td valign="top" width="5" bgcolor="#B2C4E0"><img height="5" width="5" alt="" src="./images/tab-right.gif"></td>
  77. </tr>
  78. </table>
  79. </td>
  80. </tr>
  81. </table>
  82. </div>
  83. <div class="bluebar"></div>
  84. <div class="menucontainer">
  85. <div class="menu">
  86. <ul>
  87. <li class="menuheader">Apache Ant
  88. <ul>
  89. <li>
  90. <a href="./index.html">Welcome</a>
  91. </li>
  92. <li>
  93. <a href="http://www.apache.org/licenses/LICENSE-2.0.html">License</a>
  94. </li>
  95. <li>
  96. <a href="./antnews.html">News</a>
  97. </li>
  98. </ul>
  99. </li>
  100. <li class="menuheader">Documentation
  101. <ul>
  102. <li>
  103. <a href="./manual/index.html">Manual</a>
  104. </li>
  105. <li>
  106. <a href="./projects.html">Related Projects</a>
  107. </li>
  108. <li>
  109. <a href="./external.html">External Tools and Tasks</a>
  110. </li>
  111. <li>
  112. <a href="./resources.html">Resources</a>
  113. </li>
  114. <li>
  115. <a href="./faq.html">Frequently Asked Questions</a>
  116. </li>
  117. <li>
  118. <a href="http://wiki.apache.org/ant/FrontPage">Wiki</a>
  119. </li>
  120. <li>
  121. <span class="sel">Having Problems?</span>
  122. </li>
  123. </ul>
  124. </li>
  125. <li class="menuheader">Download
  126. <ul>
  127. <li>
  128. <a href="http://ant.apache.org/bindownload.cgi">Binary Distributions</a>
  129. </li>
  130. <li>
  131. <a href="http://ant.apache.org/srcdownload.cgi">Source Distributions</a>
  132. </li>
  133. <li>
  134. <a href="http://ant.apache.org/manualdownload.cgi">Ant Manual</a>
  135. </li>
  136. </ul>
  137. </li>
  138. <li class="menuheader">Contributing
  139. <ul>
  140. <li>
  141. <a href="./mail.html">Mailing Lists</a>
  142. </li>
  143. <li>
  144. <a href="./svn.html">Subversion Repositories</a>
  145. </li>
  146. <li>
  147. <a href="./nightlies.html">Nightly+Continuous Builds</a>
  148. </li>
  149. <li>
  150. <a href="./bugs.html">Bug Database</a>
  151. </li>
  152. <li>
  153. <a href="http://www.apache.org/security/">Security</a>
  154. </li>
  155. </ul>
  156. </li>
  157. <li class="menuheader">Sponsorship
  158. <ul>
  159. <li>
  160. <a href="http://www.apache.org/foundation/thanks.html">Thanks</a>
  161. </li>
  162. <li>
  163. <a href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a>
  164. </li>
  165. </ul>
  166. </li>
  167. <li class="menuheader">Project Management
  168. <ul>
  169. <li>
  170. <a href="./contributors.html">Contributors</a>
  171. </li>
  172. <li>
  173. <a href="./mission.html">Apache Ant Mission</a>
  174. </li>
  175. <li>
  176. <a href="./bylaws.html">Project Bylaws</a>
  177. </li>
  178. <li>
  179. <a href="./legal.html">Legal</a>
  180. </li>
  181. </ul>
  182. </li>
  183. </ul>
  184. </div>
  185. <center>
  186. <a href="http://www.apache.org/events/current-event.html"><img border="0" title="ApacheCon" alt="ApacheCon - logo" src="http://www.apache.org/events/current-event-125x125.png" style="width: 125px;height: 125px;"></a>
  187. </center>
  188. <img style="float: left" height="10" width="10" border="0" alt="" src="./images/menu-left.gif">
  189. <img style="float: right" height="10" width="10" border="0" alt="" src="./images/menu-right.gif">
  190. </div>
  191. <div class="lightbluebar">&nbsp;</div>
  192. <div class="main">
  193. <div class="content">
  194. <h1 class="title">Having Problems?</h1>
  195. <h3 class="section">
  196. <a name="Having Problems?"></a>
  197. Having Problems?
  198. </h3>
  199. <p>
  200. This page details some steps you can take to try and resolve
  201. any problems you may be having with Apache Ant. If you find you can't
  202. resolve the problem, then this page will help you collect some of
  203. the relevant information to provide in a bug report. This information
  204. will help the Ant developers understand and resolve the problem.
  205. Of course, not all the steps here will make sense for every problem
  206. you may encounter - these are just some suggestions to point
  207. you in the right direction.
  208. </p>
  209. <h4 class="subsection">
  210. <a name="Ensure that you are actually running the version of Ant that you think you do"></a>
  211. Ensure that you are actually running the version of Ant that you think you do
  212. </h4>
  213. <p>Many tools include a version of Ant and some Operating
  214. Systems even install it by default now, so you may have a
  215. version of Ant installed that you haven't been aware of.</p>
  216. <p>One of the first things to do is to run
  217. <br /><br />
  218. <font face="verdana" size="-1">ant -version</font>
  219. <br /><br />
  220. and
  221. <br /><br />
  222. <font face="verdana" size="-1">ant -diagnostics</font>
  223. <br /><br />
  224. to be sure. Also, we highly recommend that you run Ant with
  225. an empty CLASSPATH. If any other version of Ant can be
  226. loaded from the CLASSPATH, many types of errors may happen
  227. because of incompatible classes being loaded.</p>
  228. <p>See <a href="faq.html">the FAQ</a> for <a href="faq.html#NoClassDefFoundError">some</a> <a href="faq.html#InstantiationException">examples</a>, but many
  229. other problems are a result of an old version of Ant on your
  230. system as well.</p>
  231. <h4 class="subsection">
  232. <a name="Read the Manual"></a>
  233. Read the Manual
  234. </h4>
  235. <p>
  236. The first step to take when you have a problem with Ant is to read
  237. the <a href="manual/index.html">manual</a> entry for the task or
  238. concept that is giving you trouble. In particular, check the
  239. meaning of a task's attributes and nested elements. Perhaps an
  240. attribute is available that would provide the behavior you require.
  241. If you have problems with the manual itself, you can submit a
  242. documentation bug report (see below) to help us improve the Ant
  243. documentation.
  244. </p>
  245. <h4 class="subsection">
  246. <a name="Examine Debug Output"></a>
  247. Examine Debug Output
  248. </h4>
  249. <p>
  250. If you're still having a problem, the next step is to try and
  251. gather additional information about what Ant is doing.
  252. Try running Ant with the <code>verbose</code> flag:
  253. <br /><br />
  254. <font face="verdana" size="-1">ant -verbose</font>
  255. <br /><br />
  256. or
  257. <br /><br />
  258. <font face="verdana" size="-1">ant -v</font>
  259. <br /><br />
  260. This will produce output that starts like the following:</p>
  261. <table class="ForrestTable" cellspacing="1" cellpadding="4">
  262. <tr>
  263. <td colspan="1" rowspan="1"
  264. valign="top" align="left">
  265. Ant version 1.4.1 compiled on October 11 2001<br />
  266. Buildfile: build.xml<br />
  267. Detected Java version: 1.3 in: D:\usr\local\java\jdk13\jre<br />
  268. Detected OS: Windows NT<br />
  269. parsing buildfile D:\ant\build.xml
  270. with URI = file:D:/ant/build.xml<br />
  271. Project base dir set to: D:\ant<br />
  272. ��[property] Loading Environment env.<br />
  273. ��[property] Loading D:\ant\conf.properties<br />
  274. Build sequence for target 'debug' is [debug]<br />
  275. Complete build sequence is [debug, gensrc, compile, jar, test]<br />
  276. . . .<br />
  277. </td>
  278. </tr>
  279. </table>
  280. <p>
  281. You should be able to see from the trace more about what Ant
  282. is doing and why it's taking a particular course of action.
  283. If you need even more information, you can use the
  284. <code>-debug</code> flag rather than
  285. <code>-verbose</code>.
  286. This will generally produce so much
  287. output that you may want to save the output to a file and
  288. analyze it in an editor. You can save the output using the
  289. <code>-logfile &lt;filename&gt;</code> flag, or
  290. using redirection.
  291. </p>
  292. <p>
  293. Once you have all this debug information, how can you use it
  294. to solve your problem? That will depend on the task in question
  295. and the nature of your problem. Each task logs different aspects
  296. of its operation, but it should give you an idea of what is going
  297. on. For example, the <code>&lt;javac&gt;</code> task logs the
  298. reasons why it
  299. chooses to compile particular class files and not others, along
  300. with which compiler it is using and the arguments it will pass
  301. to that compiler. The following partial trace shows why
  302. <code>&lt;javac&gt;</code> is adding one class file but
  303. skipping another.
  304. This is followed by which compiler it will be using, the
  305. arguments that will get passed to the compiler,
  306. and a list of all the class files to be compiled.
  307. </p>
  308. <table class="ForrestTable" cellspacing="1" cellpadding="4">
  309. <tr>
  310. <td colspan="1" rowspan="1"
  311. valign="top" align="left">
  312. [javac] Test.java omitted as D:\classes\Test.class is up to date.<br />
  313. [javac] Unset.java added as D:\classes\Unset.class is outdated.<br />
  314. [javac] Compiling 1 source file to D:\classes<br />
  315. [javac] Using classic compiler<br />
  316. [javac] Compilation args: -d D:\classes -classpath D:\classes;<br />
  317. D:\jdk118\classes.zip; -sourcepath D:\src\java -g:none<br />
  318. [javac] File to be compiled:<br />
  319. D:\src\java\Unset.java<br />
  320. </td>
  321. </tr>
  322. </table>
  323. <p>
  324. In many cases, Ant tasks are wrappers around OS commands or
  325. other Java classes. In debug mode, many of these tasks will
  326. print out the equivalent command line, as the
  327. <code>&lt;javac&gt;</code> task
  328. output does. If you are having a problem, it is often useful to
  329. run the command directly from the command line, in the same way
  330. Ant is running it, and see if the problem occurs from there
  331. as well. The problem may be in the command that is being run,
  332. or it may be in the way the Ant task is running the command.
  333. You can also see the effect of changing attribute values on the
  334. generated command line. This can help you to understand whether
  335. you are using the correct attributes and values.
  336. </p>
  337. <h4 class="subsection">
  338. <a name="Has It Been Fixed?"></a>
  339. Has It Been Fixed?
  340. </h4>
  341. <p>
  342. After examining the debug output, if you still believe that the
  343. problem you are having is caused by Ant, chances are that someone
  344. else may have already encountered this problem, and perhaps it has
  345. been fixed. The next step, therefore, would be to download the
  346. sources of ant, see <a href="svn.html">svn</a>.
  347. </p>
  348. <p>
  349. <a href="http://vmgump.apache.org/gump/public/index.html">Gump</a>
  350. is building ant every night and using the ant built from the
  351. latest source to build a long list of open source projects. However,
  352. the version of ant built by gump is not available for download. Even
  353. if it were, it would not include most of the optional tasks.
  354. </p>
  355. <p>
  356. We currently do not have nightly builds including the optional tasks.
  357. </p>
  358. <h3 class="section">
  359. <a name="bugs"></a>
  360. bugs
  361. </h3>
  362. <p>If you are convinced that you have identified an unfixed bug, please turn to
  363. our document concerning the <a href="bugs.html">bug database</a>.</p>
  364. </div>
  365. </div>
  366. <p class="copyright">
  367. <script type="text/javascript" language="JavaScript"><!--
  368. document.write(" - "+"Last Published: " + document.lastModified);
  369. // -->
  370. </script>
  371. </p>
  372. </body>
  373. </html>