Gradle - including resources in tests

拥有回忆 提交于 2020-01-05 17:17:14

问题


I have an android gradle project and java gradle project as its dependency. The second one have separated unit test classes. It contains also resources placed in src/main/resources. Problem is that resources are not being copied to test build directory.

I've found that topic: http://forums.gradle.org/gradle/topics/resources_from_src_main_resources_not_included_for_test and adding the snippet from one before last post causes that resources are added and tests are working fine but building android APK fails due to duplicate classes. Can sourceSets be altered conditionally (only for test) or maybe there is a better way to include resources in tests?

This is mentioned snippet: sourceSets { main { output.resourcesDir = "build/classes/main" } }

来源:https://stackoverflow.com/questions/24395243/gradle-including-resources-in-tests

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!