gradle - gradle 中的自定义配置
问题描述
我在 gradle 中为 jupiter (Junit 5) 测试定义了单独的配置。我在 gradle 文件中有以下代码段:
我的理解是 jupiterCompile 将从 testCompile 扩展依赖项,包括为 self 定义的任何依赖项。在这种情况下,我的 testCompile 配置没有任何 jupiter 依赖项,但由于 jupiterCompile 具有这些依赖项集,我希望它们可用。但是,如果我写 testCompile.extendsFrom jupiterCompile 它确实有效,这让我感到困惑。
configurations {
jupiterTestCompile.extendsFrom testCompile
jupiterTestRuntime.extendsFrom testRuntime
jupiterTestCompileOnly.extendsFrom testCompileOnly
}
dependencies {
def jUnitVersion = "5.5.1"
jupiterTestCompile("org.junit.jupiter:junit-jupiter-
api:${jUnitVersion}")
jupiterTestRuntime("org.junit.jupiter:junit-jupiter-
engine:${jUnitVersion}")
jupiterTestCompileOnly("org.junit.jupiter:junit-jupiter-
migrationsupport:${jUnitVersion}")
jupiterTestRuntime("org.junit.vintage:junit-vintage-
engine:${jUnitVersion}")
}
如果我在 testCompile 下定义了公共依赖项并希望 jupiterCompile 配置继承它们,那么正确的配置应该是什么?
解决方案
推荐阅读
- module - omnet 如何初始化模块和模型?
- r - How to plot bar chart grouped by secondary variable in R?
- laravel - 将 Laravel 5.4 Web App 添加到移动设备主屏幕
- javascript - 更改或覆盖 JavaScript 函数
- mongodb - 如何使用多个索引将数据导入mongodb
- javascript - 在 onKeyboardShow 函数内部更改值时,Ionic 3 输入集未触发
- shell - 切割的管道输出
- python - Python:努力掩盖数据集的一部分
- javascript - 仅在一个组件中调用方法
- sql - 使用多个左连接将行连接成一个