Windows 上 groovy 的 JMeter Grape 配置?

JMeter Grape config for groovy on Windows?

目前我正在尝试 运行 groovy JMeter 中的脚本和 windows 中的 grape: 我的 JMeter 有 c:\JMeter\lib\groovy-all.2.4.16.jar, c:\JMeter\lib\ivy-2.5.0.jar (听说需要这个).

我在 Linux 中看到了很多关于 grape 配置的示例。我将 grapeConfig.xml 放在 c:\JMeter\ 中,设置如下:

<ivysettings>
  <settings defaultResolver="downloadGrapes"/>
  <resolvers>
    <chain name="downloadGrapes">
      <filesystem name="cachedGrapes">
        <ivy pattern="${user.home}/.groovy/grapes/[organisation]/[module]/ivy-[revision].xml"/>
        <artifact pattern="${user.home}/.groovy/grapes/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"/>
      </filesystem>
      <!-- todo add 'endorsed groovy extensions' resolver here -->
      <ibiblio name="codehaus" root="http://repository.codehaus.org/" m2compatible="true"/>
      <ibiblio name="ibiblio" m2compatible="true"/>
      <ibiblio name="java.net2" root="http://download.java.net/maven/2/" m2compatible="true"/>
      <!-- this fixes the missing 2.1_3 version of cglib-nodep -->
      <ibiblio name="mirror" root="http://mirrors.ibiblio.org/maven2/" m2compatible="true"/>
    </chain>
  </resolvers>
</ivysettings>

当我在 JMeter 中执行脚本时,我收到以下错误作为 groovy @Grab:

的一部分
General error during conversion: Error grabbing Grapes -- [download failed: commons-logging#commons-logging;1.1.1!commons-logging.jar]

java.lang.RuntimeException: Error grabbing Grapes -- [download failed: commons-logging#commons-logging;1.1.1!commons-logging.jar]

如果能在 Windows 上使用 JMeter 和 groovy 正确配置葡萄,我们将不胜感激?

根据 Global grapeConfig.xml 线程 Grape 正在检查以下内容:

  • grape.config system property(如果不为空)
  • groovy.root系统属性(如果不为空)
  • user.home/.groovy 文件夹

因此,为了“告诉”JMeter 使用您的自定义 grapeConfig.xml,您需要像这样启动 JMeter:

jmeter -Dgrape.config=c:/JMeter/grapeConfig.xml -t your_script.jmx

要使更改永久生效,请将下一行添加到 system.properties 文件:

grape.config=c:/JMeter/grapeConfig.xml

更多信息: