gradle - 等价于 gradle 中测试依赖的 api
问题描述
这个问题已经发布了等同于 api for test dependency in gradle?但我没有看到任何解决方案。
我们几乎没有声明如下的依赖项
dependencies {
testImplementation 'org.apache.curator:curator-test:4.2.0'
testImplementation 'org.apache.curator:curator-framework:4.2.0'
}
我们希望将这些公开给这个库的消费者。由于它是 testImplementation,因此消费者需要显式声明我们想要避免的这些依赖项。
所以我希望将testImplementation更改为它的 api 等效项。但我在文档中找不到任何内容https://docs.gradle.org/current/userguide/java_library_plugin.html#sec:java_library_configurations_graph
解决方案
所以我希望将testImplementation更改为它的 api 等效项。但我在文档中没有找到
没有等效项,并且测试依赖项应该与主库模块分开。您将创建一个专门用于测试的单独的已发布库。这正是 Spring 项目所做的。
例如,Spring Boot 的测试库具有所有必要的测试依赖项api
:https ://github.com/spring-projects/spring-boot/blob/master/spring-boot-project/spring-boot-starters/spring -boot-starter-test/build.gradle
推荐阅读
- google-bigquery - 无法通过 ODBC 从东北亚的 BigQuery 表中获取数据
- excel - 我有 For without Next Error,不知道为什么
- expression - QlikView 在表格中添加计算维度
- java - Dockerfile Maven 插件:找不到插件
- elasticsearch - 计算过滤和排序查询的结果
- r - 从数据可视化基础重新创建绘图
- azure - 部署中指定但未部署的 Azure IoT 中心模块
- angular - 我们可以在 ionic 4 stable 中使用 angular 6 吗?
- python - 识别当前正在运行的脚本
- agda - 在 Agda-stdlib 的 IO 中使用 `do` 符号的正确方法是什么?