You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Steve Schlaifer <st...@kihakkt.jetcafe.org> on 2002/11/17 02:15:10 UTC
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.
--Steve
"Perhaps God gave man free will so he
could choose to stop those who had chosen evil."
<James Lileks>
==========================myTest.java=======================================
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import junit.framework.TestResult;
public class myTest extends TestCase {
public myTest(String name) {
super(name);
}
public static Test suite() throws ClassNotFoundException {
return new TestSuite(Class.forName("myTest"));
}
public void test0() { }
public void test1() { }
public void test2() { }
public void test3() { }
public void test4() { }
public void test5() { }
public static void main(String[] argv) throws Exception {
Test suite = suite();
junit.textui.TestRunner runner = new junit.textui.TestRunner();
TestResult result = new TestResult();
suite.run(result);
runner.print(result);
}
}
=============================build.xml=====================================
<?xml version="1.0"?>
<project name="Test" default="test" basedir=".">
<property name="JUnitJar" value="junit.jar"/>
<target name="compile">
<javac srcdir=".">
<include name="myTest.java"/>
<classpath>
<pathelement location="${JUnitJar}"/>
<pathelement path="."/>
</classpath>
</javac>
</target>
<target name="testNoFork" depends="compile">
<java classname="myTest" fork="false">
<classpath>
<pathelement location="${JUnitJar}"/>
<pathelement path="." />
</classpath>
</java>
</target>
<target name="testFork" depends="compile">
<java classname="myTest" fork="true">
<classpath>
<pathelement location="${JUnitJar}"/>
<pathelement path="." />
</classpath>
</java>
</target>
<target name="test" depends="testNoFork,testFork"/>
</project>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Problem with junit in ant with jdk 1.4.1
Posted by Stefan Bodewig <bo...@apache.org>.
On 09 Dec 2002, Stefan Bodewig <bo...@apache.org> wrote:
> 1.5.2 might be a different issue. I'll look into porting this
> specific fix over to the 1.5 branch - unless it is too big, we may
> get it out faster that way.
I've done so. A current build of the 1.5 branch can be found at
<http://cvs.apache.org/~bodewig/gump/ant1.5.2alpha/>
Stefan
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Problem with junit in ant with jdk 1.4.1
Posted by Stefan Bodewig <bo...@apache.org>.
On Fri, 6 Dec 2002, Steve Schlaifer <st...@kihakkt.jetcafe.org> wrote:
> Is there an estimate of the release date for ant 1.6?
No date we could put forward in good faith. Just now we are starting
to experiment with some stuff and it may take some time until we
settle on an implementation.
1.5.2 might be a different issue. I'll look into porting this
specific fix over to the 1.5 branch - unless it is too big, we may get
it out faster that way.
Stefan
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Problem with junit in ant with jdk 1.4.1
Posted by Steve Schlaifer <st...@kihakkt.jetcafe.org>.
On 5 Dec 2002, Stefan Bodewig wrote:
> On Sat, 16 Nov 2002, Steve Schlaifer <st...@kihakkt.jetcafe.org>
> wrote:
>
> > When I run it under ant with fork="false", it generates a
> >
> > [java] java.lang.NoClassDefFoundError:
> > sun/reflect/ConstructorAccessorImpl
>
> Could you try a recent nightly build please? This is supposed to be
> fixed in 1.6alpha now.
Indeed, it seems to be fixed now, thank you. Is there an estimate of the
release date for ant 1.6?
--Steve
"Perhaps God gave man free will so he
could choose to stop those who had chosen evil."
<James Lileks>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Problem with junit in ant with jdk 1.4.1
Posted by Stefan Bodewig <bo...@apache.org>.
On Sat, 16 Nov 2002, Steve Schlaifer <st...@kihakkt.jetcafe.org>
wrote:
> When I run it under ant with fork="false", it generates a
>
> [java] java.lang.NoClassDefFoundError:
> sun/reflect/ConstructorAccessorImpl
Could you try a recent nightly build please? This is supposed to be
fixed in 1.6alpha now.
Stefan
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>