I ran into a problem with some of my jUnit tests yesterday because we have
upgraded to crimson.jar.  I was getting conflicts with the version of
jaxp.jar included with Ant.  The solution that worked for me was to add
fork="yes" to the <batchtest> element.  However, I was dismayed to find that
I had to include ant.jar and optional.jar in the <classpath> in order for
batchtest to work.  If I don't include ant.jar, I get the following
exception:

    [junit] Running com.responsenetworks.broker.DatabaseConnectorJUnit
    [junit] java.lang.NoClassDefFoundError:
org/apache/tools/ant/BuildException
    [junit] TEST com.responsenetworks.broker.DatabaseConnectorJUnit FAILED


Below is the relevant <junit> task.

                <junit printsummary="yes" haltonfailure="no">
                        <classpath>
                                <path refid="jUnitClasspath" />
                                <pathelement
location="${AntHome}/lib/ant.jar" />
                                <pathelement
location="${AntHome}/lib/optional.jar" />
                        </classpath>

                        <formatter type="plain" />

                        <batchtest fork="yes">
                                <fileset dir="${jUnitTestPath}">
                                        <include name="**/*JUnit.java" />
                                </fileset>
                        </batchtest>
                </junit>

BTW, it was not sufficient to fork <junit>.  I actually had to fork
<batchtest> in order to get rid of ant/lib/jaxp.jar.

K.C. Baltz
Senior Engineer
Response Networks, Inc.
North Andover, MA
(978)725-3133
 

Reply via email to