bodewig 2004/04/20 00:27:21
Modified: docs faq.html
docs/manual/OptionalTasks junit.html
xdocs faq.xml
Log:
Document yet another classloading quirk within <junit>, PR: 24646
Revision Changes Path
1.97 +31 -0 ant/docs/faq.html
Index: faq.html
===================================================================
RCS file: /home/cvs/ant/docs/faq.html,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -r1.96 -r1.97
--- faq.html 14 Apr 2004 06:40:08 -0000 1.96
+++ faq.html 20 Apr 2004 07:27:20 -0000 1.97
@@ -348,6 +348,12 @@
can't seem to get the full stack trace.
</a></li>
+ <li><a href="#junit-no-runtime-xml">
+
+ Using format="xml", <junit> fails with a
+ <code>NoClassDefFoundError</code> if forked.
+
+ </a></li>
</ul>
<h3 class="section">Answers</h3>
@@ -1622,6 +1628,31 @@
<p>As a workaround, run your <java> task with
<code>fork="true"</code> and Ant will display the full
trace.</p>
+ <p class="faq">
+ <a name="junit-no-runtime-xml"></a>
+
+ Using format="xml", <junit> fails with a
+ <code>NoClassDefFoundError</code> if forked.
+
+ </p>
+ <p>The XML formatter needs the <a
href="http://www.w3.org/DOM/">DOM classes</a> to work. If you
+ are using JDK 1.4 or later they are included with your Java
+ Runtime and this problem won't occur. If you are running JDK
+ 1.3 or earlier, the DOM classes have to be on your
+ <junit> task's <classpath>.</p>
+ <p>Prior to Ant 1.6.0 Ant would include the DOM
classes from
+ the XML parser that is used by Ant itself if you set the
+ includeAntRuntime attribute to true (the default). With Ant
+ 1.6.0 this has been changed as this behavior made it
+ impossible to use a different XML parser in your tests.</p>
+ <p>This means that you have to take care of the DOM
classes
+ explicitly starting with Ant 1.6.0. If you don't need to set
+ up a different XML parser for your tests, the easiest solution
+ is to add</p>
+ <pre class="code">
+<pathelement
path="${ant.home}/lib/xml-apis.jar:${ant.home}/lib/xercesImpl.jar"/>
+</pre>
+ <p>to your task's <classpath>.</p>
</div>
</div>
1.34 +11 -1 ant/docs/manual/OptionalTasks/junit.html
Index: junit.html
===================================================================
RCS file: /home/cvs/ant/docs/manual/OptionalTasks/junit.html,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- junit.html 6 Apr 2004 14:09:25 -0000 1.33
+++ junit.html 20 Apr 2004 07:27:21 -0000 1.34
@@ -132,7 +132,11 @@
<tr>
<td valign="top">includeantruntime</td>
<td valign="top">Implicitly add the Ant classes required to run
- the tests and JUnit to the classpath in forked mode.</td>
+ the tests and JUnit to the classpath in forked mode.
+ <b>Note:</b> Please read the <a
+ href="../../faq.html#junit-no-runtime-xml">Ant FAQ</a> if you
+ want to set this to <code>false</code> and use the XML formatter
+ at the same time.</td>
<td align="center" valign="top">No; default is <code>true</code>.</td>
</tr>
<tr>
@@ -290,6 +294,12 @@
<p>If you use the XML formatter, it may not include the same output
that your tests have written as some characters are illegal in XML
documents and will be dropped.</p>
+
+<p><b>Note:</b> Please read the <a
+href="../../faq.html#junit-no-runtime-xml">Ant FAQ</a> if you want to
+set the fork attribute to <code>true</code>, the includeAntRuntime
+attribute to <code>false</code> and use the XML formatter at the same
+time.</p>
<table border="1" cellpadding="2" cellspacing="0">
<tr>
1.53 +34 -0 ant/xdocs/faq.xml
Index: faq.xml
===================================================================
RCS file: /home/cvs/ant/xdocs/faq.xml,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- faq.xml 14 Apr 2004 06:40:08 -0000 1.52
+++ faq.xml 20 Apr 2004 07:27:21 -0000 1.53
@@ -1435,6 +1435,40 @@
trace.</p>
</answer>
</faq>
+
+ <faq id="junit-no-runtime-xml">
+ <question>
+ Using format="xml", <junit> fails with a
+ <code>NoClassDefFoundError</code> if forked.
+ </question>
+ <answer>
+
+ <p>The XML formatter needs the <a
+ href="http://www.w3.org/DOM/">DOM classes</a> to work. If you
+ are using JDK 1.4 or later they are included with your Java
+ Runtime and this problem won't occur. If you are running JDK
+ 1.3 or earlier, the DOM classes have to be on your
+ <junit> task's <classpath>.</p>
+
+ <p>Prior to Ant 1.6.0 Ant would include the DOM classes from
+ the XML parser that is used by Ant itself if you set the
+ includeAntRuntime attribute to true (the default). With Ant
+ 1.6.0 this has been changed as this behavior made it
+ impossible to use a different XML parser in your tests.</p>
+
+ <p>This means that you have to take care of the DOM classes
+ explicitly starting with Ant 1.6.0. If you don't need to set
+ up a different XML parser for your tests, the easiest solution
+ is to add</p>
+
+ <source><![CDATA[
+<pathelement
path="${ant.home}/lib/xml-apis.jar:${ant.home}/lib/xercesImpl.jar"/>
+]]></source>
+
+ <p>to your task's <classpath>.</p>
+
+ </answer>
+ </faq>
</faqsection>
</document>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]