ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Loughran" <stev...@iseran.com>
Subject Re: Problem with junit in ant with jdk 1.4.1
Date Sun, 17 Nov 2002 17:55:52 GMT

----- Original Message -----
From: "Steve Schlaifer" <steve@kihakkt.jetcafe.org>
To: "Ant Users List" <ant-user@jakarta.apache.org>
Sent: Saturday, November 16, 2002 17:15
Subject: Problem with junit in ant with jdk 1.4.1


> Please see the java source file and build.xml that follow.  Running java
> 1.4.1_01 under linux as shown by
>
> onofre:2:138 % java -version
> java version "1.4.1_01"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
> Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)
>
> ant 1.5.1 as shown by
>
> onofre:2:140 % ant -version
> Apache Ant version 1.5.1 compiled on October 2 2002
>
> and junit 3.7.
>
> When I run the small test program (included below) directly
>
> onofre:2:145 % java -classpath junit.jar:. myTest
>
> OK (6 tests)
>
> it runs successfully.  Also, when I run it under ant with fork="true", it
> runs successfully.  When I run it under ant with fork="false", it
> generates a
>
>      [java] java.lang.NoClassDefFoundError:
sun/reflect/ConstructorAccessorImpl
>
> error.  The build.xml included belowe runs both the unforked and the
> forked cases in that order as seen below.
>
> onofre:2:141 % ant
> Buildfile: build.xml
>
> compile:
>
> testNoFork:
>      [java] java.lang.NoClassDefFoundError:
sun/reflect/ConstructorAccessorImpl
>
> testFork:
>
>      [java] OK (6 tests)
>
> test:
>
> BUILD SUCCESSFUL
> Total time: 2 seconds
>
> I have also found that when I comment out any one of the six test cases,
> it runs fine either forked or unforked.  Finally, when I switch back to
> jdk 1.3, it also runs without error.
>
> I've run out of ideas about what to try and am hoping somebody else
> recognizes this or has suggestions.

enable fork=true

Its a result of a stricter classloader in ant1.5 that doesnt expose all the
many extra things that were stuck in java1.4. the cvs version of ant does
expose more, but if you enable forking then things work just as well in
ant1.5. Forked jvms are better for unit tests anyway, as they dont break
your build when very bad things go wrong in the app


--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message