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

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