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.
Everything works fine when running the maven goal "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.
During test output I get the following message:
Warning:No META-INF/persistence.xml files were found in the CLASSPATH of the current thread!
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
Using maven, however, it is correctly put in the target/myapp-1.0-SNAPSHOT/WEB-INF/classes/META-INF
folder.
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.
Just because the file is placed in a directory doesn't automatically mean it's in the CLASSPATH.
Place the META-INF folder containing persistence.xml
in /src/main/resources
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With