Martin Aspeli wrote:
> 
> I have some unit tests that do things like this:
> 
> InputStream stream =
> ClassLoader.getSystemResourceAsStream("TestDBSetup.properties");
> assertNotNull("Could not load TestDBSetup.properties from classpath",
> stream);
> Properties dbProperties = new Properties();
> dbProperties.load(stream);
> 

Okay, I managed to fix <resources> so that it deploys the resources properly
- they are now found in target/test-classes (see below).

However, when I run the tests, the statement
ClassLoader.getSystemResourceAsStream("TestDBSetup.properties"); still can't
load the file. It is as if in Eclipse, the CLASSPATH contains
target/test-classes when I'm running the unit tests, and with maven/surefire
it does not. Of course, it finds the .class files...

Any ideas?

Martin

  <testResources>
            <testResource>
               <directory>src/test/resources</directory>
               <includes>
                 <include>*.*</include>
                 <filtered>false</filtered>
               </includes>
                </testResource>
                <testResource>
               <directory>src/test/java</directory>
               <includes>
                 <include>**/*.dataset.xml</include>
                 <filtered>false</filtered>
               </includes>
                </testResource>
        </testResources> 
--
View this message in context: 
http://www.nabble.com/Referencing+.properties+files+in+the+CLASSPATH+in+test-t1717149.html#a4664043
Sent from the Maven - Users forum at Nabble.com.


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

Reply via email to