Andrew McIntyre wrote:
On 1/11/07, Daniel John Debrunner <[EMAIL PROTECTED]> wrote:
Q1) The junit-oneclass target has a classpath entry:
       <classpath>
         <pathelement path="${out.dir}"/>
         <pathelement path="${junit}"/>
       </classpath>

    However if execute a target such as junit-jdbc4 target without
CLASSPATH set I fail to execute the task. When I explictly set CLASSPATH
to just contain the classes folder and junit.jar from tools/java I run
the task successfully.
So what is the above classpath entry doing?

Nothing. :-)

For the same reason that junit.jar doesn't actually get added to the
classpath, the contents of ${out.dir} are not being added either. [1]
I'm not sure that they should anyway. I think the targets should rely
on the setting of the classpath for the classes instead of trying to
set one themselves, since the user knows better than Ant whether they
want to run from the classes, jars, or at some point in the future,
however they were packaged in the distribution they downloaded.

Actually it's more than nothing, in fact it's annoying. :-)

If CLASSPATH is unset or set to empty then those lines do nothing.

If CLASSPATH includes junit.jar then those classpath pathelements do add those paths to the *front* of the classpath passed onto the JVM.

Since ${out.dir} (classes folder) is added to the front it overrides any other Derby entries in CLASSPATH, such as the jar files. So setting the CLASSPATH as this:

export CLASSPATH=`cygpath -wp "${HOME}/jars/insane/derbyTesting.jar:${HOME}/jars/insane/derby.jar:${HOME}/tools/java/junit.jar"`

does not result in the tests being run against the jar files. Thus anyone using the ant targets to run tests might not be testing what they think they are.

Can the classpath tag and its entries be removed junit-oneclass?

Thanks,
Dan.


Reply via email to