下面给出了用于运行jmeter文件的POM文件内容,但它会在命令提示符下引发诸如“您必须以格式指定有效的生命周期阶段或目标”之类的错误。请提供帮助
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>jmeter-maven</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>jmeter-maven</name>
<url>http://maven.apache.org</url>
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>1.4.1</version>
<executions>
<execution>
<id>jmeter-tests</id>
<phase>verify</phase>
<goals>
<goal>jmeter</goal>
</goals>
<configuration>
<jMeterProcessJVMSettings>
<xms>1024</xms>
<xms>1024</xms>
<arguments>
<argument>-Xprof</argument>
<argument>-Xfuture</argument>
</arguments>
</jMeterProcessJVMSettings>
<propertiesUser>
<users>${users}</users>
<rampUp>${rampUp}</rampUp>
<loop>${loopcount}</loop>
<url>${url}</url>
<suite>${suite}</suite>
</propertiesUser>
<testFilesIncluded>
<jMeterTestFile>testplans/Ecommersce.jmx</jMeterTestFile>
</testFilesIncluded>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<!-- https://mvnrepository.com/artifact/com.lazerycode.jmeter/jmeter-mavan-plugin -->
<dependency>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>com.lazerycode.jmeter</artifactId>
<version>2.1.0</version>
</dependency>
</dependencies>
</project>
当我使用Maven POM运行Jmeter文件时,在命令提示符下抛出诸如“您必须以格式指定有效的生命周期阶段或目标”之类的错误
下面的错误出现在命令窗口上
C:\Desktop\jmeter\frameworkmaven>mvn verify -Dusers=1 DrampUp=1 Dloopcount=1 Durl=www.testing.com -Dsuite=framework
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.example:jmeter-maven:jar:1.0-SNAPSHOT
[WARNING] The expression ${url} is deprecated. Please use ${project.url} instead.
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ----------------------< com.example:jmeter-maven >----------------------
[INFO] Building jmeter-maven 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.192 s
[INFO] Finished at: 2018-11-01T21:16:26+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Unknown lifecycle phase "DrampUp=1". You must specify a valid
lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[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/LifecyclePhaseNotFoundException
请为此提供帮助
答案 0 :(得分:1)
根据Jens的评论,您的命令行应为:
mvn -Dusers = 1 -DrampUp = 1 -Dloopcount = 1 -Durl = www.testing.com -Dsuite = framework clean verify
也:
您应该删除此无用的块
<dependencies>
<!-- https://mvnrepository.com/artifact/com.lazerycode.jmeter/jmeter-mavan-plugin -->
<dependency>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>com.lazerycode.jmeter</artifactId>
<version>2.1.0</version>
</dependency>
</dependencies>