Bug 1239 - JUnitTask does not include its codebase in forked command line
Summary: JUnitTask does not include its codebase in forked command line
Alias: None
Product: Ant
Classification: Unclassified
Component: Optional Tasks (show other bugs)
Version: 1.3
Hardware: PC All
: P1 normal (vote)
Target Milestone: ---
Assignee: Ant Notifications List
Depends on:
Reported: 2001-04-05 20:24 UTC by Scott M Stark
Modified: 2004-11-16 19:05 UTC (History)
1 user (show)


Note You need to log in before you can comment on or make changes to this bug.
Description Scott M Stark 2001-04-05 20:24:18 UTC
If I have placed the optional.jar and junit.jar files into the ant lib
directory so that I can run without these files in my CLASSPATH, I
am still required to do so when the junit task uses fork=true as the
codebase of the junit task is not included in the forked java command
line as shown below. So in order to run the forked junit task I need
the optional.jar and junit.jar in my CLASSPATH which defeats the purpose
of adding these jars to the ant lib directory.

build 790>ant -verbose unit-tests
Ant version 1.3 compiled on March 2 2001

Buildfile: build.xml
Detected Java Version: 1.3
Detected OS: Windows 2000
    [junit] Executing: java -classpath D:\usr\local\src\cvsroot\jBoss\jbosssx\bu
\jnpserver.jar org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner org.
jboss.test.LoginModulesTest haltOnError=false haltOnFailure=true formatter=org.a
    [junit] java.lang.NoClassDefFoundError: org/apache/tools/ant/taskdefs/option
Comment 1 Stefan Bodewig 2001-05-04 02:12:33 UTC
I don't think we should implicitly add Ant's runtime classes to the classpath
for <junit> - some things work if you run junit forked but not if you run
things in VM, just because we don't include everything from ANT_HOME/lib (tests
that require a different XML parser for example).

If we had a way to only include the classpath entries that contain the junit
task and junit.jar itself, fine. But this may be difficult to find out - I'll 
investigate this a little.  You cannot rely on the task being defined in

Finally, you should get a running fork="true" version, if you give a nested
classpath element to <junit> that contains all required classes.
Comment 2 Stefan Bodewig 2001-07-12 00:10:05 UTC
fixed for JDK > 1.1 starting with nightly build 2001-07-13