我正在通过com.lazerycode.jmeter使用Apache JMeter对我的Web应用程序进行性能测试:jmeter-maven-plugin.
由于版本3.2带来了很多变化,我想知道我是否可以在jmeter-maven-plugin中使用这个版本(这不是Apache JMeter项目的一部分).
我尝试了以下方法:
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>2.1.0</version>
<configuration>
<jmeterVersion>3.2</jmeterVersion>
<jMeterProcessJVMSettings>
<xms>1024</xms>
<xmx>1024</xmx>
<arguments>
<argument>-Xprof</argument>
<argument>-Xfuture</argument>
</arguments>
</jMeterProcessJVMSettings>
</configuration>
<executions>
<execution>
<id>jmeter-tests</id>
<phase>test</phase>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
jmeter-maven-plugin中jmeter的标准版本是3.1.
我发现这是指定库:
https://github.com/jmeter-maven-plugin/jmeter-maven-plugin/wiki/Specifying-JMeter-Version
上面的配置对我不起作用.我得到一个NPE(空指针异常).
[INFO] >>> jmeter-maven-plugin:2.1.0:jmeter (jmeter-tests) > :configure @ EAdresseBatchImportCapacityTests >>>
[INFO]
[INFO] --- jmeter-maven-plugin:2.1.0:configure (configure) @ EAdresseBatchImportCapacityTests ---
[INFO] -------------------------------------------------------
[INFO] Configuring JMeter...
[INFO] -------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.136 s
[INFO] Finished at: 2017-04-28T13:28:40+02:00
[INFO] Final Memory: 20M/217M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.lazerycode.jmeter:jmeter-maven-plugin:2.1.0:configure (configure) on project EAdresseBatchImportCapacityTests: Failure to find org.apache.jmeter:ApacheJMeter_monitors:jar:3.2 in http://maven-repository.11.am-gruppe.de:8090/nexus/content/groups/gdis was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced -> [Help 1]
如果我使用上面链接中描述的旧库(ApacheJMeter_monitors:jar:3.1),它不起作用(NPE),不存在较新的库,因为monitor-package已从项目依赖项中删除. (你可以在这里看到:https://jmeter.apache.org/usermanual/build-monitor-test-plan.html)
我是否必须等待新版本的jmeter-maven-plugin?
也许你们中的某个人可以帮助我弄清楚如何让它发挥作用.
提前致谢.
最佳答案 2017年5月17日编辑:
适用于JMeter 3.2的maven插件2.2.0已发布,附带以下发行说明:
> https://github.com/jmeter-maven-plugin/jmeter-maven-plugin/blob/master/CHANGELOG.md
发布之前的回答:
JMeter 3.2的maven插件尚未发布:
> https://github.com/jmeter-maven-plugin/jmeter-maven-plugin/issues/212
也许对作者的问题发表评论.
要解决此问题,请编辑pom.xml并添加:
<configuration>
<jmeterVersion>3.2</jmeterVersion>
<jmeterArtifacts>
<jmeterArtifact>org.apache.jmeter:ApacheJMeter:3.2</jmeterArtifact>
<jmeterArtifact>org.apache.jmeter:ApacheJMeter_components:3.2</jmeterArtifact>
<jmeterArtifact>org.apache.jmeter:ApacheJMeter_config:3.2</jmeterArtifact>
<jmeterArtifact>org.apache.jmeter:ApacheJMeter_core:3.2</jmeterArtifact>
<jmeterArtifact>org.apache.jmeter:ApacheJMeter_ftp:3.2</jmeterArtifact>
<jmeterArtifact>org.apache.jmeter:ApacheJMeter_functions:3.2</jmeterArtifact>
<jmeterArtifact>org.apache.jmeter:ApacheJMeter_http:3.2</jmeterArtifact>
<jmeterArtifact>org.apache.jmeter:ApacheJMeter_java:3.2</jmeterArtifact>
<jmeterArtifact>org.apache.jmeter:ApacheJMeter_jdbc:3.2</jmeterArtifact>
<jmeterArtifact>org.apache.jmeter:ApacheJMeter_jms:3.2</jmeterArtifact>
<jmeterArtifact>org.apache.jmeter:ApacheJMeter_junit:3.2</jmeterArtifact>
<jmeterArtifact>org.apache.jmeter:ApacheJMeter_ldap:3.2</jmeterArtifact>
<jmeterArtifact>org.apache.jmeter:ApacheJMeter_mail:3.2</jmeterArtifact>
<jmeterArtifact>org.apache.jmeter:ApacheJMeter_mongodb:3.2</jmeterArtifact>
<jmeterArtifact>org.apache.jmeter:ApacheJMeter_native:3.2</jmeterArtifact>
<jmeterArtifact>org.apache.jmeter:ApacheJMeter_tcp:3.2</jmeterArtifact>
<jmeterArtifact>org.apache.jmeter:jorphan:3.2</jmeterArtifact>
</jmeterArtifacts>
</configuration>