Not that I know of.  Instead, I would just put the valid.xml file
directly into src/test/resources instead of the XML subdirectory.  Then
you shouldn't have to put a path at all.

..David..
 

-----Original Message-----
From: Alex Wood [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 23, 2005 2:51 PM
To: Maven Users List
Subject: RE: [m1] Reading Test Resources

> Do you mean the resource files aren't getting put into 
> target/test-classes or that target/test-classes isn't in the
classpath?
> 
> If the resource file is in a subdirectory of src/test/resources, then 
> your filename in the test code will need to include the subdirectory 
> name.
> 
> ..David..
> 
> 

Thanks David, the subdirectory path was the trick.  I had the files in
target/test-classes/resources/XML and the two lines below worked.

String filename = "/resources/XML/valid.xml"; InputStream is =
MyClassTest.class.getResourceAsStream(filename);

Just as a side-note, the slash before "resources" is required.

I found a thread discussing the same issue here

http://marc.theaimsgroup.com/?l=turbine-maven-user&m=108758456117192&w=2

Is there anyway to add the resource directories to the classpath as well
so I don't have to use as long of a path when I load up the files?
----------------
Regards,
Alex

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to