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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <?xml version="1.0"?>
  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. <document>
  17. <properties>
  18. <author email="">Conor MacNeill</author>
  19. <title>Having Problems?</title>
  20. </properties>
  21. <body>
  22. <section name="Having Problems?">
  23. <p>
  24. This page details some steps you can take to try and resolve
  25. any problems you may be having with Apache Ant. If you find you can't
  26. resolve the problem, then this page will help you collect some of
  27. the relevant information to provide in a bug report. This information
  28. will help the Ant developers understand and resolve the problem.
  29. Of course, not all the steps here will make sense for every problem
  30. you may encounter - these are just some suggestions to point
  31. you in the right direction.
  32. </p>
  33. <subsection name="Ensure that you are actually running the version of Ant that you think you do">
  34. <p>Many tools include a version of Ant and some Operating
  35. Systems even install it by default now, so you may have a
  36. version of Ant installed that you haven't been aware of.</p>
  37. <p>One of the first things to do is to run
  38. <br></br><br></br>
  39. <font face="verdana" size="-1">ant -version</font>
  40. <br></br><br></br>
  41. and
  42. <br></br><br></br>
  43. <font face="verdana" size="-1">ant -diagnostics</font>
  44. <br></br><br></br>
  45. to be sure. Also, we highly recommend that you run Ant with
  46. an empty CLASSPATH. If any other version of Ant can be
  47. loaded from the CLASSPATH, many types of errors may happen
  48. because of incompatible classes being loaded.</p>
  49. <p>See <a href="faq.html">the FAQ</a> for <a
  50. href="faq.html#NoClassDefFoundError">some</a> <a
  51. href="faq.html#InstantiationException">examples</a>, but many
  52. other problems are a result of an old version of Ant on your
  53. system as well.</p>
  54. </subsection>
  55. <subsection name="Read the Manual">
  56. <p>
  57. The first step to take when you have a problem with Ant is to read
  58. the <a href="manual/index.html">manual</a> entry for the task or
  59. concept that is giving you trouble. In particular, check the
  60. meaning of a task's attributes and nested elements. Perhaps an
  61. attribute is available that would provide the behavior you require.
  62. If you have problems with the manual itself, you can submit a
  63. documentation bug report (see below) to help us improve the Ant
  64. documentation.
  65. </p>
  66. </subsection>
  67. <subsection name="Examine Debug Output">
  68. <p>
  69. If you're still having a problem, the next step is to try and
  70. gather additional information about what Ant is doing.
  71. Try running Ant with the <code>verbose</code> flag:
  72. <br></br><br></br>
  73. <font face="verdana" size="-1">ant -verbose</font>
  74. <br></br><br></br>
  75. or
  76. <br></br><br></br>
  77. <font face="verdana" size="-1">ant -v</font>
  78. <br></br><br></br>
  79. This will produce output that starts like the following:</p>
  80. <table>
  81. <tr>
  82. <td>
  83. Ant version 1.4.1 compiled on October 11 2001<br></br>
  84. Buildfile: build.xml<br></br>
  85. Detected Java version: 1.3 in: D:\usr\local\java\jdk13\jre<br></br>
  86. Detected OS: Windows NT<br></br>
  87. parsing buildfile D:\ant\build.xml
  88. with URI = file:D:/ant/build.xml<br></br>
  89. Project base dir set to: D:\ant<br></br>
  90. &#160;&#160;[property] Loading Environment env.<br></br>
  91. &#160;&#160;[property] Loading D:\ant\conf.properties<br></br>
  92. Build sequence for target &#39;debug&#39; is [debug]<br></br>
  93. Complete build sequence is [debug, gensrc, compile, jar, test]<br></br>
  94. . . .<br></br>
  95. </td>
  96. </tr>
  97. </table>
  98. <p>
  99. You should be able to see from the trace more about what Ant
  100. is doing and why it's taking a particular course of action.
  101. If you need even more information, you can use the
  102. <code>-debug</code> flag rather than
  103. <code>-verbose</code>.
  104. This will generally produce so much
  105. output that you may want to save the output to a file and
  106. analyze it in an editor. You can save the output using the
  107. <code>-logfile &lt;filename&gt;</code> flag, or
  108. using redirection.
  109. </p>
  110. <p>
  111. Once you have all this debug information, how can you use it
  112. to solve your problem? That will depend on the task in question
  113. and the nature of your problem. Each task logs different aspects
  114. of its operation, but it should give you an idea of what is going
  115. on. For example, the <code>&lt;javac&gt;</code> task logs the
  116. reasons why it
  117. chooses to compile particular class files and not others, along
  118. with which compiler it is using and the arguments it will pass
  119. to that compiler. The following partial trace shows why
  120. <code>&lt;javac&gt;</code> is adding one class file but
  121. skipping another.
  122. This is followed by which compiler it will be using, the
  123. arguments that will get passed to the compiler,
  124. and a list of all the class files to be compiled.
  125. </p>
  126. <table>
  127. <tr>
  128. <td>
  129. [javac] Test.java omitted as D:\classes\Test.class is up to date.<br></br>
  130. [javac] Unset.java added as D:\classes\Unset.class is outdated.<br></br>
  131. [javac] Compiling 1 source file to D:\classes<br></br>
  132. [javac] Using classic compiler<br></br>
  133. [javac] Compilation args: -d D:\classes -classpath D:\classes;<br></br>
  134. D:\jdk118\classes.zip; -sourcepath D:\src\java -g:none<br></br>
  135. [javac] File to be compiled:<br></br>
  136. D:\src\java\Unset.java<br></br>
  137. </td>
  138. </tr>
  139. </table>
  140. <p>
  141. In many cases, Ant tasks are wrappers around OS commands or
  142. other Java classes. In debug mode, many of these tasks will
  143. print out the equivalent command line, as the
  144. <code>&lt;javac&gt;</code> task
  145. output does. If you are having a problem, it is often useful to
  146. run the command directly from the command line, in the same way
  147. Ant is running it, and see if the problem occurs from there
  148. as well. The problem may be in the command that is being run,
  149. or it may be in the way the Ant task is running the command.
  150. You can also see the effect of changing attribute values on the
  151. generated command line. This can help you to understand whether
  152. you are using the correct attributes and values.
  153. </p>
  154. </subsection>
  155. <subsection name="Has It Been Fixed?">
  156. <p>
  157. After examining the debug output, if you still believe that the
  158. problem you are having is caused by Ant, chances are that someone
  159. else may have already encountered this problem, and perhaps it has
  160. been fixed. The next step, therefore, would be to download the
  161. sources of ant, see <a href="svn.html">svn</a>.
  162. </p>
  163. <p>
  164. <a href="http://vmgump.apache.org/gump/public/index.html">Gump</a>
  165. is building ant every night and using the ant built from the
  166. latest source to build a long list of open source projects. However,
  167. the version of ant built by gump is not available for download. Even
  168. if it were, it would not include most of the optional tasks.
  169. </p>
  170. <p>
  171. We currently do not have nightly builds including the optional tasks.
  172. </p>
  173. </subsection>
  174. </section>
  175. <section name="bugs">
  176. <p>If you are convinced that you have identified an unfixed bug, please turn to
  177. our document concerning the <a href="bugs.html">bug database</a>.</p>
  178. </section>
  179. </body>
  180. </document>