From cdf5f5a1874afc3d481067ca4aaf80b836f5bb52 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Tue, 20 Apr 2004 07:27:21 +0000 Subject: [PATCH] Document yet another classloading quirk within , PR: 24646 git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@276350 13f79535-47bb-0310-9956-ffa450edef68 --- docs/faq.html | 31 +++++++++++++++++++++++++ docs/manual/OptionalTasks/junit.html | 12 +++++++++- xdocs/faq.xml | 34 ++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+), 1 deletion(-) diff --git a/docs/faq.html b/docs/faq.html index 8971fa607..1ef498b8d 100644 --- a/docs/faq.html +++ b/docs/faq.html @@ -347,6 +347,12 @@ The program I run via <java> throws an exception but I can't seem to get the full stack trace. + +
  • + + Using format="xml", <junit> fails with a + NoClassDefFoundError if forked. +
  • @@ -1622,6 +1628,31 @@ mv /tmp/foo $ANT_HOME/bin/antRun

    As a workaround, run your <java> task with fork="true" and Ant will display the full trace.

    +

    + + + Using format="xml", <junit> fails with a + NoClassDefFoundError if forked. + +

    +

    The XML formatter needs the DOM classes 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>.

    +

    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.

    +

    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

    +
    +<pathelement path="${ant.home}/lib/xml-apis.jar:${ant.home}/lib/xercesImpl.jar"/>
    +
    +

    to your task's <classpath>.

    diff --git a/docs/manual/OptionalTasks/junit.html b/docs/manual/OptionalTasks/junit.html index 9569b9c68..0fcf47e74 100644 --- a/docs/manual/OptionalTasks/junit.html +++ b/docs/manual/OptionalTasks/junit.html @@ -132,7 +132,11 @@ elements).

    includeantruntime Implicitly add the Ant classes required to run - the tests and JUnit to the classpath in forked mode. + the tests and JUnit to the classpath in forked mode. + Note: Please read the Ant FAQ if you + want to set this to false and use the XML formatter + at the same time. No; default is true. @@ -291,6 +295,12 @@ can be specified.

    that your tests have written as some characters are illegal in XML documents and will be dropped.

    +

    Note: Please read the Ant FAQ if you want to +set the fork attribute to true, the includeAntRuntime +attribute to false and use the XML formatter at the same +time.

    + diff --git a/xdocs/faq.xml b/xdocs/faq.xml index 10d94f842..47c395e2c 100644 --- a/xdocs/faq.xml +++ b/xdocs/faq.xml @@ -1435,6 +1435,40 @@ mv /tmp/foo $ANT_HOME/bin/antRun trace.

    + + + + Using format="xml", <junit> fails with a + NoClassDefFoundError if forked. + + + +

    The XML formatter needs the DOM classes 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>.

    + +

    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.

    + +

    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

    + + +]]> + +

    to your task's <classpath>.

    + +
    +
    \ No newline at end of file
    Attribute