gpt4 book ai didi

scope - 如何在 Gradle 构建中使用为 jar 文件提供的范围?

转载 作者:行者123 更新时间:2023-12-03 07:22:19 25 4
gpt4 key购买 nike

我需要在我的应用程序中使用 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com