Hi,
I'm still an ant man, having managed to avoid maven so far. But if you run your tests with the classpath including the classes and test-classes directory, then this should work fine. It's what I'm doing for unit testing EJB3 using the ejb3 embedded container.
You'd think this is how maven would be running your tests by default, so I'm not sure what the problem is. In ant, I have something like:
Code:
<path id="junit.classpath">
<fileset dir="${lib.dir}/ejb3-embedded">
<include name="*.jar" />
</fileset>
<pathelement location="${test.classes.dir}" />
<pathelement location="${classes.dir}" />
<pathelement location="${lib.dir}/ejb3-embedded/conf" />
...
...
...
</path>
As long as I put "test.classes.dir" above my "class.dir", the correct persistence.xml gets picked up, and it finds my persistent class fine.
hope it helps,
D.