You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Marcin Cinik (JIRA)" <ji...@codehaus.org> on 2012/01/06 11:54:02 UTC

[jira] (SUREFIRE-770) persistence.xml in src/test/resources/META-INF is not taken into account

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

Marcin Cinik commented on SUREFIRE-770:
---------------------------------------

I'm facing the same issue. This is in my opinion not an issue with JPA. In any situation, there is a configuration file which must be different for testing/normal build, this problem occurs. 
Let's say I have
src/main/resources/META-INF/ejb-jar.xml
src/test/resources/META-INF/ejb-jar.xml

those two files contain different configuration (for whatever reason - you can imagine that I'm binding mock session beans instead of real ones). In this case the plugin would create two directories
target/classes/META-INF/ejb-jar.xml
target/test-classes/META-INF/ejb-jar.xml

and include both files in the classpath which disables our embedded testing app-server from resolving the right one.

I don't understand the rationale behind the last comment of Kristian Rosenvold:
{quote}
Complain to JPA about this issue
{quote}
 Can you spotlight a bit what you meant ? It looks like it doesn't only concern JPA...



                
> 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