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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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/">
  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="/builds/jakarta-ant/nightly/">Jakarta web site</a>. While Ant nightly
  96. builds are typically quite stable and are used by <a href="/builds/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="/builds/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 currently open and resolved bugs to see if your
  109. problem has already been reported. If it has, you can see whether any of the developers have commented,
  110. suggesting workarounds or the reason for the bug, etc. You may have more information to add (see about
  111. creating bug reports below), in which case, go right ahead and add it. If you can't add more information
  112. you may just want to vote for this bug, and perhaps add yourself to the CC list to follow the progress of
  113. this bug.
  114. </p>
  115. </subsection>
  116. <subsection name="Filing a Bug report">
  117. <p>By this time you may have decided that there is a bug in Ant. You have a few choices at this
  118. point. You can send an email to the ant-user mailing list to see if others have encountered your issue
  119. and how they may have worked around it. If after some discussion, you still feel you have a bug, it
  120. is time to create a bug report. This is a simple operation in the Bug Database. Please try to provide
  121. as much information as possible to assist the developers in resolving the bug. Please try to enter correct
  122. values for the various inputs when creating the bug. Once the bug is created you can add attachments to
  123. the bug report.
  124. </p>
  125. <p>What information should you include in your bug report? The easiest bugs to fix are those which are most
  126. easily reproducible, so if you can, it is really helpful to produce a small test case that exhibits the
  127. problem. In this case, you would attach the build file and other files necessary to reproduce the problem
  128. probably packed together in an archive. If you can't produce a test case, you should try to include a
  129. snippet from your build file and the relevant sections from the debug out from Ant. Try to include the
  130. header information where Ant states the version, the OS and VM information etc. As the debug output is
  131. likely to be very large, you should try to remove the output which is not relevant. Once the bug is
  132. entered into the Bug Database, you will be kept informed about progress on the bug. If you receive email
  133. asking for further information, please try to respond as it will aid in the resolution of your bug.
  134. </p>
  135. </subsection>
  136. <subsection name="Fixing the Bug">
  137. <p>If you aren't satisfied just filing a bug report, you can try to find and fix the problem yourself. The
  138. best way to do that is by working against the latest code from CVS. Alternatively, you can work with the
  139. source code from the source distributions available on the Jakarta website. If you are going to tackle the
  140. issues at this level, you may want to discuss details on the ant-dev mailing list. Once you have a fix
  141. for the problem, you may either submit the patch to the ant-dev mailing list or enter into the Bug
  142. Database as described above, attaching the patch. Using the Bug database has the advantage of tracking
  143. the progress of your bug.
  144. </p>
  145. </subsection>
  146. </section>
  147. </body>
  148. </document>