On 12/24/06, Benson Margulies <[EMAIL PROTECTED]> wrote:

I have a class that calls ClassLoader.getSystemResourceAsStream to
retrieve an XML file. All is well when running the live code, and even
when running JUnit from Eclipse. From surefire, the XML file is not
found.

I sense that I'm missing something about class paths, but I can't find
anything really apposite in the documentation.

I can reproduce it, but I can't explain it.

According to the Surefire docs [1], tests normally run in an isolated
classloader.

However, setting childDelegation=true, which supposedly "makes tests
run using the standard classloader delegation instead of the default
Maven isolated classloader" didn't help matters.

With src/main/resources/temp.properties, running from Surefire,
  ClassLoader.getSystemResourceAsStream("temp.properties");
returns null while
  this.getClass().getClassLoader().getResourceAsStream("temp.properties");
doesn't.

In IDEA, neither one returns null (and the tests pass.)

Here's a sample project if you want to play with it:
http://people.apache.org/~wsmoak/maven/system-resource-1.0-SNAPSHOT-src.zip

[1] http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html

--
Wendy

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

Reply via email to