gpt4 book ai didi

gradle - 如何将属性传递给依赖项?

转载 作者:行者123 更新时间:2023-12-03 04:06:59 25 4
gpt4 key购买 nike

Gradle jettyRun任务具有守护程序属性,我在启动应用程序时希望为false,但当我将其作为接受测试(fastend2end)任务的依赖项时为true。

task fastend2end(type: Test, dependsOn: jettyRun) {
description = "Runs the end to end tests"
testClassesDir = sourceSets.end2end.classesDir
classpath = sourceSets.end2end.runtimeClasspath
}

我可以指定fastend2end守护程序为true吗?但是,当我自己运行jettyRun时,我希望daemon属性为false。

最佳答案

您不能直接这样做。但是,如果fastend2end任务在您的执行图中,则可以使用以下代码段设置daemon属性:

gradle.taskGraph.whenReady {graph ->
if (graph.hasTask(fastend2end)) {
jettyRun.daemon = true
}
}

关于gradle - 如何将属性传递给依赖项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6299077/

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