[ 
https://jira.codehaus.org/browse/SUREFIRE-770?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=287640#comment-287640
 ] 

Kristian Rosenvold commented on SUREFIRE-770:
---------------------------------------------

The way this works is that when the tests are being run, the classpath for the 
/tests/ will be *before* the the classpath of the regular production files in 
the classpath. So even though there are multiple instances of the file, even 
the most brain damaged of tools should pick up the files in the correct 
classpath order.

In a multi-module project only the "test" scope of the module being run is 
included in the classpath, which means that your test-scoped configuration 
needs to be in src/test/resources of the actual unit test project being run. If 
this sounds like a limitation you can build a separate jar file with test scope 
that contains these jar files.

The linked stackoverflow post seems to indicate that JPA has somehow messed up 
this scheme.
                
> persistence.xml in src/test/resources/META-INF is not taken into account
> ------------------------------------------------------------------------
>
>                 Key: SUREFIRE-770
>                 URL: https://jira.codehaus.org/browse/SUREFIRE-770
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: classloading
>    Affects Versions: 2.9
>         Environment: Windows XP
>            Reporter: Wolfgang Grossinger
>              Labels: proposedWontFix
>             Fix For: Backlog
>
>
> When i have a persistence.xml in /src/main/resources/META-INF and in 
> /src/test/resources/META-INF the xml for the test is never used. I found a 
> few issues how to fix this but nobody had an explanation why this behavior is 
> as it is. For me this behavior is really strange (and I couldn't believe that 
> this is not my fault and is really not working). It seem this has to do with 
> classloading - in my opinion, the test classes and the test resources should 
> have priority, otherwise the whole separation of main/test is useless. I 
> hope, that there is no real reason why this is so at the moment, because this 
> behavior is really strange and absolutely against what the normal user would 
> expect.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to