Hello Keith,

I don't *think* you need xalan.jar in the ANT_HOME/lib any more - have you tried removing it? There are some other jars in there that might conflict...
here's my test:


C:\TanguyLand>echo %JAVA_HOME%
C:\j2sdk1.4.2_01

C:\TanguyLand>echo %CLASSPATH%
%CLASSPATH% <- i.e. no classpath

C:\TanguyLand>echo %ANT_HOME%
C:\apache-ant-1.6.0

C:\TanguyLand>ls %ANT_HOME%/lib
AntDoc.jar               ant-jakarta-regexp.jar  ant-trax.jar
README                   ant-javamail.jar        ant-vaj.jar
ant-antlr.jar            ant-jdepend.jar         ant-weblogic.jar
ant-apache-bsf.jar       ant-jmf.jar             ant-xalan1.jar
ant-apache-resolver.jar  ant-jsch.jar            ant-xalan2.jar
ant-commons-logging.jar  ant-junit.jar           ant-xslp.jar
ant-commons-net.jar      ant-launcher.jar        ant.jar
ant-icontract.jar        ant-netrexx.jar         junit.jar
ant-jai.jar              ant-nodeps.jar          log4j-1.2.8.jar
ant-jakarta-bcel.jar     ant-starteam.jar        xercesImpl.jar
ant-jakarta-log4j.jar    ant-stylebook.jar       xml-apis.jar
ant-jakarta-oro.jar      ant-swing.jar

C:\TanguyLand>ls -R
.:
bin  build  build.xml  dist  doc  lib  scrap  src

./bin:
org

./bin/org:
tanguyland

./bin/org/tanguyland:
AllTests.class  CalcUtilities.class  CalcUtilitiesTest.class

./build:
org

./build/org:
tanguyland

./build/org/tanguyland:
AllTests.class  CalcUtilities.class  CalcUtilitiesTest.class

./dist:
tanguyland.jar

./doc:
api

./doc/api:

./lib:
junit.jar

./scrap:
calcscrap.jpage

./src:
org

./src/org:
tanguyland

./src/org/tanguyland:
AllTests.java  CalcUtilities.java  CalcUtilitiesTest.java

C:\TanguyLand>more build.xml
<?xml version="1.0"?>
<project name="TanguyLand" basedir="." default="compile">
       <!-- properties -->
       <property name="source.dir" location="src"/>
       <property name="build.dir" location="build"/>
       <property name="doc.dir" location="doc"/>
       <property name="javadoc.dir" location="${doc}/api"/>
       <property name="dist.dir" location="dist"/>
       <property name="lib.dir" location="lib"/>
       <property name="jarfile.name" value="tanguyland.jar"/>
       <!--<property name="junit.tests.failed" value="false"/>-->
       <!-- classpaths -->
       <path id="compile.class.path">
               <fileset dir="${lib.dir}" includes="**/*.jar"/>
       </path>

       <!-- targets -->
       <target name="init">
               <tstamp/>
               <mkdir dir="${build.dir}"/>
               <mkdir dir="${dist.dir}"/>
       </target>

<target name="compile" depends="init" description="compile the source">
<javac destdir="${build.dir}" deprecation="on">
<src path="${source.dir}"/>
<classpath refid="compile.class.path"/>
</javac>
</target>


<target name="clean" description="empties the dist and build directories">
<delete includeemptydirs="true" failonerror="false">
<fileset dir="${build.dir}"/>
<fileset dir="${dist.dir}"/>
</delete>
</target>


<target name="dist" depends="compile" description="makes the distributable jar file">
<jar destfile="${dist.dir}/${jarfile.name}"
basedir="${build.dir}"
excludes="**/*Test.class,**/*Tests.class"/>
</target>


<target name="test" depends="compile" description="runs the junit tests">
<junit printsummary="on" failureproperty="${junit.tests.failed}" showoutput="no">
<batchtest>
<formatter type="plain" usefile="false"/>
<fileset dir="${build.dir}">
<include name="**/*Test*.class"/>
<exclude name="**/AllTests.class"/>
</fileset>
</batchtest>
<classpath>
<pathelement location="${build.dir}"/>
</classpath>
</junit>
<fail if="${junit.tests.failed}" message="there are failed JUnit tests. See output."/>
</target>


<target name="all" depends="clean,test,dist" description="clean build, test and jar of the whole app"/>
</project>



C:\TanguyLand>ant test Buildfile: build.xml

init:

compile:

test:
   [junit] Running org.tanguyland.CalcUtilitiesTest
   [junit] Tests run: 4, Failures: 0, Errors: 0, Time elapsed: 0.016 sec

   [junit] Testsuite: org.tanguyland.CalcUtilitiesTest
   [junit] Tests run: 4, Failures: 0, Errors: 0, Time elapsed: 0.016 sec

   [junit] Testcase: testAdd took 0.016 sec
   [junit] Testcase: testSubtract took 0 sec
   [junit] Testcase: testMultiply took 0 sec
   [junit] Testcase: testDivide took 0 sec


BUILD SUCCESSFUL Total time: 1 second C:\TanguyLand>

Keith Hatton wrote:

I'm just taking a look at Ant 1.6 and I'm having a problem with a build file that works fine in 1.5.3.

java -version gives 1.3.1
ant -version gives 1.6

The only changes to the standard installation is that I've copied junit.jar and xalan.jar into ANT_HOME/lib (which I did for Ant 1.5) - prior to this the build complained that it couldn't find JUnit classes.

Now for *every* test suite in the build I get the following error.

   [junit] java.lang.NoClassDefFoundError: org/w3c/dom/Node
   [junit]     at java.lang.Class.forName0(Native Method)
   [junit]     at java.lang.Class.forName(Class.java:120)
   [junit]     at org.apache.tools.ant.taskdefs.optional.junit.FormatterElement
..createFormatter(FormatterElement.java:236)
   [junit]     at org.apache.tools.ant.taskdefs.optional.junit.FormatterElement
..createFormatter(FormatterElement.java:220)
   [junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.
createAndStoreFormatter(JUnitTestRunner.java:586)
   [junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.
main(JUnitTestRunner.java:531)

I'm guessing that this must have something to do with the re-packaing of JARs in ANT_HOME/lib or the scary bit in the release notes about changes to classloaders. If anyone has come across similar problems, or has ideas for how to fix this, I'd be glad to hear from them.

Thanks
Keith


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]







---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to