You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Jim Crossley (JIRA)" <ji...@codehaus.org> on 2007/02/26 22:30:15 UTC

[jira] Closed: (SUREFIRE-294) Test resources not found in classpath

     [ http://jira.codehaus.org/browse/SUREFIRE-294?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jim Crossley closed SUREFIRE-294.
---------------------------------

    Resolution: Fixed

Nevermind.  I'm sorry.  My bad.

I was misinterpreting the error message to mean that META-INF/persistence.xml couldn't be found.  They were being found alright, but they were misconfigured.  Adding deps for hibernate-entitymanager and hsqldb to the pom, and adding this to persistence.xml yielded the correct results...

  <persistence-unit name="fake">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <properties>
      <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
      <property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/>
      <property name="hibernate.connection.username" value="sa"/>
      <property name="hibernate.connection.password" value=""/>
      <property name="hibernate.connection.url" value="jdbc:hsqldb:."/>
      <property name="hibernate.max_fetch_depth" value="2"/>
      <property name="hibernate.hbm2ddl.auto" value="update"/>
      <property name="hibernate.show_sql" value="true"/>
    </properties>
  </persistence-unit>

Sorry for the trouble.

> Test resources not found in classpath
> -------------------------------------
>
>                 Key: SUREFIRE-294
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-294
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: classloading
>    Affects Versions: 1.5.3 (2.1.3 plugin), 2.0 (2.2 plugin), 2.4
>         Environment: Linux, JDK 1.5
>            Reporter: Jim Crossley
>            Priority: Blocker
>         Attachments: surefire-classpath-test.zip
>
>
> Attached is a simple project demonstrating that the Surefire plugin cannot find the correct META-INF/persistence.xml when trying to create a JPA EntityManagerFactory in the setup method of AppTest.java.  There are two persistence units defined:  the "real" one in src/main/resources/META-INF/persistence.xml and the "fake" one in src/test/resources/META-INF/persistence.xml.  The test case should work if Surefire can find the "fake" one, which it currently can't.  Incidentally, it can't even find the "real" one.  It's as if the resources directories are simply not added to the classpath during test invocation.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira