我需要在我的应用程序中使用 Amazon Maps 和 Amazon Messaging。
使用 gradle,我没有成功添加具有“提供”范围的 Amazon 依赖项 as they need to be :
The JAR file contains stub implementations of the Amazon Maps API. It does not contain actual implementations of the Maps API classes, so you should not compile the JAR into your app.
None of the solutions provided by Amazon support worked为我。
如果有人成功通过 Gradle 使用亚马逊 map 或亚马逊消息传递,请在此处分享您的 build.gradle 文件。
最佳答案
在 2.12 release of Gradle , compileOnly
添加的目的是为 provided
范围提供类似的功能。测试类路径中发生的情况有所不同。以下是发行说明中的相关引用和片段:
You can now declare dependencies to be used only at compile time in conjunction with the Java plugin. Compile only dependencies are used only during source compilation and are not included in the runtime classpath or exposed to dependent projects. This behavior is similar to that of the 'provided' scope available in Maven based builds. However, unlike Maven provided dependencies, compile only dependencies in Gradle are not included on the test classpath.
Compile only dependencies should be assigned to the relevant source set's 'compileOnly' configuration.
dependencies { compileOnly 'javax.servlet:servlet-api:2.5' }
关于scope - 如何在 Gradle 构建中使用为 jar 文件提供的范围?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18738888/