gpt4 book ai didi

gradle - 并行运行具有不同参数的相同gradle任务?

转载 作者:行者123 更新时间:2023-12-03 03:47:03 24 4
gpt4 key购买 nike

我想同时运行两个带有不同参数的gatlingRun任务(由gatling gradle插件创建)(在2个环境中)。

我知道新的gradle提供了Worker API,但这在这种情况下似乎并不适用。

最佳答案

就像您说的那样,Gradle Worker API并不是真正适用于您的情况,因为它支持并行处理,但是在单个Task的上下文中,如文档所述:

The Worker API provides the ability to break up the execution of a task action into discrete units of work and then to execute that work concurrently and asynchronously.



为了使不同的任务并行运行,您可以使用 Parallel execution功能。但是请注意,只有当任务属于(同一多项目构建的)不同子项目时,才可以并行运行任务:

Most builds consist of more than one project and some of those projects are usually independent of one another. Yet Gradle will only run one task at a time by default, regardless of the project structure (this will be improved soon). By using the --parallel switch, you can force Gradle to execute tasks in parallel as long as those tasks are in different projects.



如果将构建脚本“仅”用作Gatlin负载测试的启动器,则也许可以将构建脚本实现为多项目构建,每个目标环境可以测试一个子项目;那么您可以启用 --parallel选项来并行执行负载测试任务。

关于gradle - 并行运行具有不同参数的相同gradle任务?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53083036/

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