Problem: In the JUnit optional task, the <classpath> nested tag does not have the desired effect for JUnit with fork="no" (the default). Instead of coming from the tag, JUnit's classpath comes from the $CLASSPATH system environment variable. Workaround: use the fork="yes" option or set the $CLASSPATH environment variable. Another user report follows, detailing the same problem and another workaround. (He and I are using the same versions of software, but I'm running on Solaris.) -- From: opensourcetim@yahoo.com (Tim Rapp) Newsgroups: comp.lang.java Subject: Re: JUnit 3.7 with Ant 1.4 Property definitions - doesn't work Date: 26 Oct 2001 12:23:25 -0700 Organization: http://groups.google.com/ Lines: 33 Message-ID: <b66a2a66.0110261123.3af8849f@posting.google.com> References: <170adb52.0110170416.231a2c50@posting.google.com> NNTP-Posting-Host: 208.243.87.205 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1004124205 15024 127.0.0.1 (26 Oct 2001 19:23:25 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 26 Oct 2001 19:23:25 GMT christopher.ross@fmr.com (christopher) wrote in message news:<170adb52.0110170416.231a2c50@posting.google.com>... > My Ant JUnits always fail with an Ant Property defined CLASSPATH. > > The error is 'cannot find the optional.jar' - > which is on the Property defined CLASSPATH. These > same Property definitions converted to env vars work great! I have > also tried some <systemproperty> and <classpath> overrides in the > JUnit task itself to no avail. Thanks Christopher, I had the same problem. To fix, I added "set CLASSPATH=C:\myproject\lib\junit.jar" to my NT script that calls Ant. I still have a <classpath> tag in my <junit> task. Excerpts from my build.xml file (unnecessary details replaced with ...) are below: <path id="test.classpath" > <pathelement location="${lib}/junit.jar" /> <pathelement location="${lib}/httpunit.jar" /> <pathelement location="${lib}/parser.jar" /> <pathelement location="${classes}" /> <path refid="tomcat.classpath" /> <path refid="mysql.classpath" /> </path> ... <junit ... > <classpath> <path refid="test.classpath" /> </classpath> ... </junit> Seems like this should be added to the Ant documentation for the <junit> task. FYI, I'm running Ant 1.4.1, JUnit 3.7, Win2k Pro, and JDK 1.3.1.
*** This bug has been marked as a duplicate of 6606 ***