谷歌应用引擎的gradle单元测试在哪里期待persistence.xml? [英] Where do gradle unit tests for Google app engine expect persistence.xml?

查看:106
本文介绍了谷歌应用引擎的gradle单元测试在哪里期待persistence.xml?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用Maven原型项目与Datanucleus JPA提供程序创建了一个Google应用程序引擎项目,基本上遵循Google应用程序引擎文档。



运行时一切正常maven目标测试。

现在我必须将该项目集成到Android studio中,并且希望将构建脚本迁移到gradle。我将所有依赖从 pom.xml 复制到 build.gradle 中,并且项目生成良好。但是,所有访问Google数据存储区的测试都会失败。



在测试输出中,我收到以下消息:


警告:在当前线程的CLASSPATH中找不到META-INF / persistence.xml文件!

我检查了在构建过程中创建的 build 文件夹,没有任何文件夹包含 persistence.xml $ c> src / main / webapp / WEB-INF / classes / META-INF



然而,使用maven,

我有尝试使用gradle copy任务将 persistence.xml 复制到各个位置,比如 build / classes / META-INF build / classes / webapp / WEB-INF / classes / META-INF 等等,但是没有任何工作。

解决方案

仅仅因为文件被放置在目录中并不会自动执行它位于CLASSPATH中。



将包含 persistence.xml 的META-INF文件夹放入 / src / main / resources


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.

这篇关于谷歌应用引擎的gradle单元测试在哪里期待persistence.xml?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆