我在JMeter中創建了一個簡單的測試,我希望使用Maven運行它。我的pom.xml看起來象下面這樣:無法執行目標com.lazerycode.jmeter:jmeter-maven-plugin:1.9.0:jmeter
<?xml version="1.0" encoding="utf-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.epg</groupId>
<artifactId>jmeter-maven</artifactId>
<version>0.1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>JMeter Maven</name>
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>1.9.0</version>
<executions>
<execution>
<id>jmeter-tests</id>
<phase>verify</phase>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
<configuration>
<resultsFileNameDateFormat>yyyyMMddHHmmss</resultsFileNameDateFormat>
<resultsFileFormat>xml</resultsFileFormat>
</configuration>
</plugin>
</plugins>
</build>
</project>
,當我執行命令MVN安裝我得到:
[info] Executing test: Sample Test.jmx
[info] Completed Test: Sample Test.jmx
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.811 s
[INFO] Finished at: 2017-08-08T16:21:23+02:00
[INFO] Final Memory: 16M/245M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.lazerycode.jmeter:jmeter-maven-plugin:1.9.0:jmeter (jmeter-tests) on project jmeter-maven: c:\...\target\jmeter\results\20170808162123-Sample Test.jtl (The system cannot find the file specified) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.lazerycode.jmeter:jmeter-maven-plugin:1.9.0:jmeter (jmeter-tests) on project jmeter-maven: c:\...\target\jmeter\results\20170808162123-Sample Test.jtl (The system cannot find the file specified)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: c:\...\target\jmeter\results\20170808162123-Sample Test.jtl (The system cannot find the file specified)
at com.lazerycode.jmeter.JMeterMojo.parseTestResults(JMeterMojo.java:75)
at com.lazerycode.jmeter.JMeterMojo.execute(JMeterMojo.java:54)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 20 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
看來,測試中執行,但由於某種原因,報告未創建。當我執行maven調用的相同命令時(jmeter -n -tc:... \ src \ test \ jmeter \ Sample Test.jmx -lc:... \ target \ jmeter \ results \ 20170808162635-Sample Test.jtl - dc:... \ target \ jmeter -jc:... \ target \ jmeter \ logs \ Sample Test.jmx.log)一切正常。一些想法?每JMeter Maven Plugin releases page
通過JMeter的,Maven的插件的變化版本1.9.0,從2.1.0到解決 – user3568916