且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Maven的测试过程中的persistence.xml未找到

更新时间:2023-11-18 08:18:28

只是一个基于Maven的/ Eclipse的JPA项目解决了同样的问题。

Just solved the same problem with a Maven/Eclipse based JPA project.

我有我的META-INF目录下的的src / main / JAVA 与concequence,它没有在测试阶段之前复制到目标目录。

I had my META-INF directory under src/main/java with the concequence that it was not copied to the target directory before the test phase.

这个目录移动到的src / main /资源解决了这个问题,并确保了 META-INF / persistence.xml中文件是目标/班present 当测试运行。

Moving this directory to src/main/resources solved the problem and ensured that the META-INF/persistence.xml file was present in target/classes when the tests were run.

我的认为的是,JPA面把我的 META-INF / persistence.xml中文件中的的src / main / java的,这竟然是我的问题的根源。

I think that the JPA facet put my META-INF/persistence.xml file in src/main/java, which turned out to be the root of my problem.