Izbassar Tolegen
Izbassar Tolegen

Reputation: 2152

How to exclude persistence.xml from maven resolver

I'm using arquillian for tests, and I have many modules. One of them is for entites, and another - is service layer. So I already had tested all of my model module and now trying to test service layer with mocked repositories. However I'm adding my model dependency like that with maven resolver:

File[] hrModel =
            Maven.resolver().loadPomFromFile("pom.xml")
.resolve("com.mycompany:hr-model:0.1").withTransitivity()
                 .asFile();

On my model module persistence.xml is configured to do drop-and-create (JPA 2.1 property) when generating schema, so when I run my test using resolved dependency (above), I see that actually schema generation process is started all over again, so my question is: can someone provide a way to not include persistence.xml in resolved dependency or just include class files from it or is there another solution?

Upvotes: 0

Views: 575

Answers (1)

coladict
coladict

Reputation: 5095

You can create a second persistence.xml in the src/test/resources/META-INF path that will be loaded instead of the main one when running tests. You can have that one with different settings and not drop-create the schema.

Upvotes: 1

Related Questions