The jetty:run target causes the test-compile life cycle phase to complete before it jetty:run . Therefore, skipping tests will not change anything.
What you need to do is bind the execution of copy-test-persistence to the lifecycle phase behind test-compile , but before test . And there are not a dozen candidates, but only one: process-test-classes .
This conceptually may not be perfect, but it is the least worst option and it will work:
<plugin> <artifactId>maven-antrun-plugin</artifactId> <version>1.3</version> <executions> <execution> <id>copy-test-persistence</id> <phase>process-test-classes</phase> <configuration> <tasks> <copy file="${project.build.testOutputDirectory}/META-INF/persistence.xml.test" tofile="${project.build.outputDirectory}/META-INF/persistence.xml" overwrite="true" verbose="true" failonerror="true" /> </tasks> </configuration> <goals> <goal>run</goal> </goals> </execution> ... </executions> </plugin>
source share