You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

升级Gatling至3.9.0后Jar启动器报错的解决方法

解决Gatling 3.9.0升级后bzt构建错误

问题重现

将Gatling从3.7.6升级到3.9.0后,build.gradle.kts配置如下:

plugins {
    id("scala")
    id("io.gatling.gradle") version "3.9.0"
}
gatling {
    logHttp = io.gatling.gradle.LogHttp.FAILURES
    logLevel = "WARN"
}
tasks.register("prepareTests") {
    dependsOn("gatlingEnterprisePackage")
    from("bzt")
    from("$buildDir/libs") {
        include("${project.name}-tests.jar")
    }
    into("$buildDir/bzt")
}
repositories {
    maven {
        url = uri("https://repo1.maven.org/maven2/")
    }
}
dependencies {
    gatling("com.typesafe.play:play-json_2.13:2.10.0-RC7")
}

执行构建时出现错误:

14:23:56 INFO: Downloading: https://repo1.maven.org/maven2/io/gatling/highcharts/gatling-charts-highcharts-bundle/3.9.0/gatling-charts-highcharts-bundle-3.9.0-bundle.zip
100% [===========================================================================================================================================================================================] Time: 0:00:18
14:24:14 INFO: Unzipping /tmp/tmpcol8v6jb.zip
14:24:15 INFO: Installed Gatling successfully
**14:24:19 ERROR: Child Process Error: Can’t modify gatling launcher** for jar usage, ability isn’t supported
14:24:19 INFO: Post-processing…
14:24:19 INFO: Artifacts dir: /tmp/artifacts
14:24:19 WARNING: Done performing with code: 1

解决方案

这个错误源于BlazeMeter Taurus(bzt)旧版本不兼容Gatling 3.9.0的启动器结构,可通过以下步骤修复:

  • 升级bzt到最新稳定版
    旧版本bzt无法适配Gatling 3.9.0的启动器变更,使用包管理器升级:

    pip install --upgrade bzt
    
  • 替换依赖为稳定版本
    依赖中的play-json使用了候选版本,换成对应Scala 2.13的稳定版可避免潜在兼容性问题:

    dependencies {
        gatling("com.typesafe.play:play-json_2.13:2.9.2")
    }
    
  • 优化prepareTests任务逻辑
    直接引用gatlingEnterprisePackage的输出文件,避免依赖固定路径,同时无需让bzt修改启动器:

    tasks.register("prepareTests") {
        dependsOn("gatlingEnterprisePackage")
        from("bzt")
        from(tasks.named("gatlingEnterprisePackage").map { it.outputs.files }) {
            include("*.jar")
        }
        into("$buildDir/bzt")
    }
    
  • 检查bzt配置文件
    如果使用了bzt-config.json这类配置文件,确保其中Gatling版本指定为3.9.0,且没有启用修改启动器的配置项。

内容的提问来源于stack exchange,提问作者Monika Rajendran

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.02 06:45:35