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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <?xml version="1.0"?>
  2. <document>
  3. <properties>
  4. <author email="conor@apache.org">Conor MacNeill</author>
  5. <title>Having Problems?</title>
  6. </properties>
  7. <body>
  8. <section name="Having Problems?">
  9. <p>If you are having problems with Ant, this page details some steps you can take
  10. to try and resolve the problem. If you can't resolve the problem then this page will help
  11. you collect some of the relevant information to provide a bug report. This information will help
  12. the Ant developers understand and resolve the problem. Of course, not all of the steps here will
  13. make sense for every problem you encounter. These are just some suggestions to
  14. point you in the right direction.
  15. </p>
  16. <subsection name="Read the Manual">
  17. <p>The first step to take when you have a problem is to read the <a href="manual/index.html">
  18. manual</a> entry for the task or concept that is giving you trouble. Check particularly the meaning of
  19. attributes and nested elements. Perhaps an attribute would provide the behavior you require. If you
  20. have problems with the manual, then you can submit a documentation bug report (see below) to help us
  21. improve the Ant documentation.
  22. </p>
  23. </subsection>
  24. <subsection name="Examine Debug Output">
  25. <p>The first step when you have a problem is to see what Ant is doing. Try running Ant with
  26. The verbose flag<br/><br/>
  27. <code>ant -verbose</code><br/><br/>
  28. or<br/><br/>
  29. <code>ant -v</code><br/><br/>
  30. This will produce something which starts like the following:</p>
  31. <source>
  32. Ant version 1.4alpha compiled on August 6 2001
  33. Buildfile: build.xml
  34. Detected Java version: 1.3 in: f:\jdk1.3\jre
  35. Detected OS: Windows NT
  36. parsing buildfile \jakarta-ant\build.xml with
  37. URI = file:/jakarta-ant/build.xml
  38. Project base dir set to: \jakarta-ant
  39. [property] Loading \jakarta-ant\.ant.properties
  40. [property] Unable to find property file: \jakarta-ant\.ant.properties
  41. [property] Loading \conor\.ant.properties
  42. [property] Override ignored for debug
  43. prepare:
  44. check_for_optional_packages:
  45. ...
  46. </source>
  47. <p>
  48. You may be able to see in this trace what ant is doing and why it takes a particular
  49. course of action. If you need even more information you can use the <code>-debug</code>
  50. flag rather than <code>-verbose</code>. This will generally produce so much output that
  51. you may want to save the output and analyze it in an editor.
  52. </p>
  53. <p>So, once you have all this debug information, how can you use it to solve your problem?
  54. That will depend on the task in question and the nature of your problem. Each task logs
  55. different aspects of its operation, but it will give you an idea of what is going on. For
  56. example, the &lt;javac&gt; task logs the reasons why it chooses to compile particular
  57. classes and the equivalent command it is using. The following trace (which has been edited
  58. and reformatted for clarity) shows javac adding one class but skipping another. This is followed
  59. by the compiler arguments and a summary of all the classes to be compiled.
  60. </p>
  61. <source>
  62. [javac] org\apache\tools\ant\listener\Log4jListener.java added as
  63. \build\classes\org\apache\tools\ant\listener\Log4jListener.class
  64. is outdated.
  65. [javac] org\apache\tools\ant\Location.java omitted as
  66. \build\classes\org\apache\tools\ant\Location.class is up to date.
  67. ...
  68. [javac] Compiling 1 source file to \jakarta-ant\build\classes
  69. [javac] Using modern compiler
  70. [javac] Compilation args: -d \jakarta-ant\build\classes -classpath
  71. \jakarta-ant\build\classes;F:\jdk1.3\lib\tools.jar;
  72. \Ant\lib\optional.jar;\Ant\lib\log4j.jar;
  73. \Ant\lib\junit.jar;\Ant\lib\jaxp.jar;
  74. \Ant\lib\crimson.jar;\Ant\lib\ant.jar
  75. -sourcepath \jakarta-ant\src\main -g:none -O
  76. [javac] File to be compiled:
  77. \src\main\org\apache\tools\ant\listener\Log4jListener.java
  78. </source>
  79. <p>
  80. In many cases Ant tasks are wrappers around OS commands or other java classes. In debug mode, many
  81. of these tasks will print out the equivalent command line, as the &lt;javac&gt; task above does. If
  82. you are having a problem, it is often useful to run the command directly in the same way Ant is doing
  83. and see if the problem persists. The problem may lie in the command being run by Ant, or in the way
  84. the Ant task is running the command. You can also see the effect of changing attribute values on the
  85. generated command line. This can help you to understand whether you are using the correct attributes
  86. and values.
  87. </p>
  88. </subsection>
  89. <subsection name="Has it been fixed?">
  90. <p>
  91. After examining the debug output, you still believe that the problem you are having may be caused by Ant.
  92. Chances are that someone else may have already encountered this problem and perhaps it has been
  93. fixed. The next step, therefore, may be to try a nightly build of Ant to see if the
  94. problem has been fixed. Nightly builds for Ant are available from the
  95. <a href="http://www.apache.org/dist/jakarta/jakarta-ant/nightly/">Jakarta web site</a>. While Ant nightly
  96. builds are typically quite stable and are used by <a href="http://www.apache.org/dist/jakarta/gump/latest/">
  97. Gump</a> to build many other Jakarta projects, these builds should be treated as experimental. You can
  98. install and verify whether your problem has been fixed. Note that nightly builds do not build many of the
  99. optional tasks the come with Ant. A snapshot of these optional tasks is occasionally uploaded to the nightly
  100. download <a href="http://www.apache.org/dist/jakarta/jakarta-ant/nightly/optional/">area</a>. Note that even
  101. this snapshot does not contain every optional task.
  102. </p>
  103. </subsection>
  104. <subsection name="Has it been reported?">
  105. <p>
  106. If the current nightly build doesn't resolve your problem, it is possible that someone else has reported
  107. the issue. It is time to look at the <a href="http://nagoya.apache.org/bugzilla/">Apache Bug Database</a>.
  108. This system is easy to use and it will let you search the
  109. <a href="http://nagoya.apache.org/bugzilla/buglist.cgi?bug_status=UNCONFIRMED&amp;bug_status=NEW&amp;bug_status=ASSIGNED&amp;bug_status=REOPENED&amp;email1=&amp;emailtype1=substring&amp;emailassigned_to1=1&amp;email2=&amp;emailtype2=substring&amp;emailreporter2=1&amp;bugidtype=include&amp;bug_id=&amp;changedin=&amp;votes=&amp;chfieldfrom=&amp;chfieldto=Now&amp;chfieldvalue=&amp;product=Ant&amp;short_desc=&amp;short_desc_type=substring&amp;long_desc=&amp;long_desc_type=substring&amp;bug_file_loc=&amp;bug_file_loc_type=substring&amp;keywords=&amp;keywords_type=anywords&amp;field0-0-0=noop&amp;type0-0-0=noop&amp;value0-0-0=&amp;order=bugs.bug_id">
  110. currently open
  111. </a>.
  112. and resolved bugs to see if your problem has already been reported.
  113. If your problem has been reported, you can see whether any of the developers have commented,
  114. suggesting workarounds or the reason for the bug, etc. You may have more information to add (see about
  115. creating bug reports below), in which case, go right ahead and add it. If you can't add more information
  116. you may just want to vote for this bug, and perhaps add yourself to the CC list to follow the progress of
  117. this bug.
  118. </p>
  119. </subsection>
  120. <subsection name="Filing a Bug report">
  121. <p>By this time you may have decided that there is a bug in Ant. You have a few choices at this
  122. point. You can send an email to the ant-user mailing list to see if others have encountered your issue
  123. and how they may have worked around it. If after some discussion, you still feel you have a bug, it
  124. is time to create a bug report. This is a simple operation in the Bug Database. Please try to provide
  125. as much information as possible to assist the developers in resolving the bug. Please try to enter correct
  126. values for the various inputs when creating the bug. Once the bug is created you can add attachments to
  127. the bug report.
  128. </p>
  129. <p>What information should you include in your bug report? The easiest bugs to fix are those which are most
  130. easily reproducible, so if you can, it is really helpful to produce a small test case that exhibits the
  131. problem. In this case, you would attach the build file and other files necessary to reproduce the problem
  132. probably packed together in an archive. If you can't produce a test case, you should try to include a
  133. snippet from your build file and the relevant sections from the debug out from Ant. Try to include the
  134. header information where Ant states the version, the OS and VM information etc. As the debug output is
  135. likely to be very large, you should try to remove the output which is not relevant. Once the bug is
  136. entered into the Bug Database, you will be kept informed about progress on the bug. If you receive email
  137. asking for further information, please try to respond as it will aid in the resolution of your bug.
  138. </p>
  139. </subsection>
  140. <subsection name="Asking for an enhancement">
  141. <p>Sometimes, you may find that Ant just doesn't do what you want. It isn't a bug, as such, since Ant
  142. is working the way it is supposed to. Perhaps it is something that hasn't been thought of yet, or
  143. a completely new task. For these situations you will want to raise an enhancement request.
  144. Enhancement requests are managed using the same Apache Bug Database described above.
  145. These are just a different type of report. If you look in the database, you will see that one of
  146. the severity settings for a bug is &quot;Enhancement&quot;. So, just fill the bug report in, and
  147. in the description, state how you would like to have Ant enhanced. Again you should check whether
  148. there are any existing enhancment requests that cover your needs. If so, just add your vote to these.
  149. </p>
  150. </subsection>
  151. <subsection name="Fixing the Bug">
  152. <p>If you aren't satisfied just filing a bug report, you can try to find and fix the problem yourself. The
  153. best way to do that is by working against the latest code from CVS. Alternatively, you can work with the
  154. source code from the source distributions available on the Jakarta website. If you are going to tackle the
  155. issues at this level, you may want to discuss details on the ant-dev mailing list. Once you have a fix
  156. for the problem, you may either submit the patch to the ant-dev mailing list or enter into the Bug
  157. Database as described above, attaching the patch. Using the Bug database has the advantage of tracking
  158. the progress of your bug.
  159. </p>
  160. </subsection>
  161. </section>
  162. </body>
  163. </document>