So, I have a project which uses persistence.xml in main, it is in src/main/resources/META-INF
Now i want to use an in-memory database (H2) in writing automated unit test so i need to have another persistence.xml, i have it in src/test/resouce/META-INF
So my question is how can i over-ride the first persistence,
I am also using shrikwrap resolver to resolve all dependencies from pom.xml, so it resolves it all and i add it to shrikwrap to return WebArchive, is there any way, i tried many such as creating profile or maven filetering but doesnt work with Arquillian as i resolve everything and add to deployment.
You can find my Arquillian deployment below :
WebArchive[] file = Maven.resolver().loadPomFromFile("pom.xml")
.resolve("G:A:V").withTransitivity().as(WebArchive.class);
WebArchive war = ShrinkWrap.create(WebArchive.class, "test.war")
.addAsResource("META-INF/persistence.xml")
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
war.addAsLibraries(file);
return war;
Have you tried adding the new resource after
addAsLibrary(file)
?