I have created a Google app engine project using an maven archetype project with the Datanucleus JPA provider, essentially following the Google app engine documentation.
我使用与Datanucleus JPA提供商的maven原型项目创建了一个Google应用引擎项目,主要遵循Google应用引擎文档。
Everything works fine when running the maven goal "test".
当运行maven目标“test”时,一切正常。
Now I had to integrate the project into Android studio and wanted to migrate the build script to gradle. I copied all dependencies from the pom.xml
to the build.gradle
and the project builds fine. However, all tests that access the Google datastore fail.
现在我必须将项目集成到Android studio中,并希望将构建脚本迁移到gradle。我将所有依赖项从pom.xml复制到build.gradle,项目构建正常。但是,访问Google数据存储区的所有测试都会失败。
During test output I get the following message:
在测试输出期间,我收到以下消息:
Warning:No META-INF/persistence.xml files were found in the CLASSPATH of the current thread!
警告:在当前线程的CLASSPATH中找不到META-INF / persistence.xml文件!
I checked the build
folder which is created during the build and no folder contains the persistence.xml
from src/main/webapp/WEB-INF/classes/META-INF
我检查了构建期间创建的构建文件夹,没有文件夹包含src / main / webapp / WEB-INF / classes / META-INF中的persistence.xml
Using maven, however, it is correctly put in the target/myapp-1.0-SNAPSHOT/WEB-INF/classes/META-INF
folder.
但是,使用maven,它被正确放入target / myapp-1.0-SNAPSHOT / WEB-INF / classes / META-INF文件夹中。
I have tried copying the persistence.xml
using a gradle copy task into various locations, such as build/classes/META-INF
build/classes/webapp/WEB-INF/classes/META-INF
and so on, but nothing worked.
我已经尝试使用gradle复制任务将persistence.xml复制到各个位置,例如build / classes / META-INF build / classes / webapp / WEB-INF / classes / META-INF等,但没有任何效果。
1 个解决方案
#1
15
Just because the file is placed in a directory doesn't automatically mean it's in the CLASSPATH.
仅仅因为文件放在目录中并不会自动意味着它在CLASSPATH中。
Place the META-INF folder containing persistence.xml
in /src/main/resources
.
将包含persistence.xml的META-INF文件夹放在/ src / main / resources中。
#1
15
Just because the file is placed in a directory doesn't automatically mean it's in the CLASSPATH.
仅仅因为文件放在目录中并不会自动意味着它在CLASSPATH中。
Place the META-INF folder containing persistence.xml
in /src/main/resources
.
将包含persistence.xml的META-INF文件夹放在/ src / main / resources中。