Error "You must specify a valid lifecycle phase or a goal in the format" while executing jmeter test using Maven

9.1k views Asked by At

POM file content am using to run jmeter file is given below but it is throwing error like "You must specify a valid lifecycle phase or a goal in the format" in command prompt.Please help on this

    <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>

When I run Jmeter file using Maven POM it is throwing error like "You must specify a valid lifecycle phase or a goal in the format" in command prompt

Below error am getting on command window

  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

Kindly help on this

1

There are 1 answers

0
UBIK LOAD PACK On BEST ANSWER

As per Jens comment, your command line should be:

mvn -Dusers=1 -DrampUp=1 -Dloopcount=1 -Durl=www.testing.com -Dsuite=framework clean verify

Also:

  • you should use version 2.8.0 of jmeter-maven-plugin
  • you should remove this block which is useless

    <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>