我目前正在开发一个基于 jmeter 的项目,使用 jmeter maven 插件运行测试。到目前为止,一切正常,直到我添加了 perfmon 插件,使用 jmeter UI 添加它们以获取每秒事务数和随时间变化的响应时间,按照此处的说明进行操作
现在在 Maven 中运行它会导致:
[INFO] Error in NonGUIDriver java.lang.IllegalArgumentException: Problem loading XML from:'/Users/foo/Tools/src/platform-load-test/jersey2-load-test/target/jmeter/testFiles/JerseyAsync.jmx', missing class com.thoughtworks.xstream.converters.ConversionException:
[INFO] ---- Debugging information ----
[INFO] cause-exception : com.thoughtworks.xstream.converters.ConversionException
[INFO] cause-message :
[INFO] first-jmeter-class : org.apache.jmeter.save.converters.HashTreeConverter.unmarshal(HashTreeConverter.java:67)
[INFO] class : org.apache.jmeter.save.ScriptWrapper
[INFO] required-type : org.apache.jorphan.collections.ListedHashTree
[INFO] converter-type : org.apache.jmeter.save.ScriptWrapperConverter
[INFO] path : /jmeterTestPlan/hashTree/hashTree/hashTree/kg.apc.jmeter.perfmon.PerfMonCollector
[INFO] line number : 259
[INFO] version : 3.1 r1770033
[INFO] -------------------------------
按照文档添加其他库(因为我已经通过 jmeter ui 的插件管理器添加了 perfmon 侦听器),我更新了我的 pom 添加了 jmeter 扩展部分:
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>2.1.0</version>
<executions>
<execution>
<id>jmeter-tests</id>
<phase>pre-integration-test</phase>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
<configuration>
<ignoreResultFailures>true</ignoreResultFailures>
<jmeterExtensions>
<jmeterExtension>kg.apc:jmeter-plugins-perfmon:2.1</jmeterExtension>
</jmeterExtensions>
</configuration>
</plugin>
和分析部分:
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-analysis-maven-plugin</artifactId>
<version>1.0.6</version>
<executions>
<execution>
<id>analyze-results</id>
<phase>post-integration-test</phase>
<goals>
<goal>analyze</goal>
</goals>
</execution>
</executions>
<configuration>
<source>${project.basedir}/target/jmeter/results/*.jtl</source>
<targetDirectory>${project.basedir}/target/reports</targetDirectory>
</configuration>
</plugin>
但是,这会导致:
[INFO] -------------------------------------------------------
[INFO] Configuring JMeter...
[INFO] -------------------------------------------------------
[WARNING] The POM for commons-math3:commons-math3:jar:3.4.1 is missing, no dependency information available
[WARNING] The POM for commons-pool2:commons-pool2:jar:2.3 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.196 s
[INFO] Finished at: 2017-02-16T16:13:31+08:00
[INFO] Final Memory: 20M/437M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.lazerycode.jmeter:jmeter-maven-plugin:2.1.0:configure (configure) on project jersey2-load-test: Failure to find commons-math3:commons-math3:jar:3.4.1 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
这指出声明了无效的依赖项 假设 im 在为 jmeter 添加 jar 扩展的正确路径中,我如何排除无效的依赖项并使用插件的 jmeter 扩展部分添加正确的依赖项?否则在使用 jmeter maven 插件时如何正确添加 perfmon 插件依赖项?