【发布时间】:2020-08-05 20:04:57
【问题描述】:
在 gradle 5.6.2 中,我有一个带有子项目的项目。子项目中的测试共享很多代码,所以我希望子项目测试依赖于父项目测试。但是测试中的引用无法解析,即使主项目中的引用可以解析。 Gradle 文档说使用“map notation”依赖声明,并且这个依赖块不会产生错误:
dependencies {
api project(":henchbot-api")
testImplementation project(path: ':henchbot-api', configuration: 'testRuntime')
}
...但是测试不会编译。如果我将 testRunTime 更改为 testRuntimeClasspath 则 gradle 无法解决该项目依赖关系。
【问题讨论】:
标签: testing gradle dependencies classpath