우리는 MySQL을 프로덕션에서 사용하고 Derby는 단위 테스트를 위해 사용합니다. 우리의 pom.xml 파일 복사 테스트 이전의 persistence.xml의 더비 버전 및 MySQL 버전으로 대체가에서 준비 패키지 단계 :mvn 부두를 방지하는 방법 : 테스트 단계 실행에서 실행 하시겠습니까?
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<id>copy-test-persistence</id>
<phase>process-test-resources</phase>
<configuration>
<tasks>
<!--replace the "proper" persistence.xml with the "test" version-->
<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>
<execution>
<id>restore-persistence</id>
<phase>prepare-package</phase>
<configuration>
<tasks>
<!--restore the "proper" persistence.xml-->
<copy
file="${project.build.outputDirectory}/META-INF/persistence.xml.production"
tofile="${project.build.outputDirectory}/META-INF/persistence.xml"
overwrite="true" verbose="true" failonerror="true" />
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
문제는 내가 MVN 부두를 실행하면 것을,이다 : 그것은를 실행 실행 jetty를 시작하기 전에 persistence.xml 파일 복사 작업을 테스트하십시오. 배포 버전을 사용하여 실행되기를 원합니다. 이 문제를 어떻게 해결할 수 있습니까?
만약 내가 이미 테스트를 언급하는 것을 잊었다하지만, 도움이되지 않습니다 개념적 어쩌면 이상적인 아니지만, 그것은 적어도 더 나쁜 옵션, 그리고 그것을 작동합니다
. – tputkonen