ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephane Bailliez <>
Subject RE: Junit task / Resources
Date Tue, 08 May 2001 18:31:53 GMT

If you are running JUnit in non forked mode, then this is somewhat the
'expected bug behavior' since the AntClassLoader does not override the
getResource() method while getResourceAsStream is

It did not follow the issue closely but there are bugs already entered about
this, one of these is

I believe some patches were sent, but it does not seem to be committed yet.

 St├ęphane Bailliez 
 Software Engineer, Paris - France 
 iMediation - 
 Disclaimer: All the opinions expressed above are mine and not those from my

> -----Original Message-----
> From: Bryce Penberthy []
> Sent: Tuesday, May 08, 2001 6:03 PM
> To:
> Subject: Junit task / Resources
> Hello,
> I have a JUnit test that will cause a class to try to load an 
> XML file as
> a URL resource.  If I run this straight from JUnit with the 
> appropriate
> CLASSPATH environment variable set then it works fine.  
> However if I try
> to run this within the JUnit task, then the class is unable 
> to find the
> XML file.
> Currently javac will output the classes to a build output 
> directory, then
> copy all .xml and .properties files over to this structure.  When the
> JUnit task runs, I figured that I would just add the build output
> directory to the classpath there.
> I have a path refid that I am using for the <classpath> element, and I
> have echo'ed it to verify that my build output directory exists
> there.  It will run the test classes, but somehow never pick 
> up the xml
> file.  Currently I am not forking the JUnit process.
> One twist that I have found is that if I specify the build 
> output file in
> the CLASSPATH environment variable before running Ant, then 
> it works like
> a charm.  However I am trying to get away from my build.xml 
> file having
> dependencies on environment variables..
> Has anyone run into this problem?  Any help would be greatly 
> appreciated.
> Thank you
> Bryce Penberthy

View raw message