0
votes

I am trying to run my jmx file which is src/test/jmeter using maven POM.xml , but am getting error

i have provided the version 5.1.1 in pom.xml , still saying this plugin needs 5.1.1 version of jmeter.

Will this plugin automatically downloads jmeter ? or do i have to manually download and keep in src/test/jmeter folder ?

version used below :

<dependency>
    <groupId>com.lazerycode.jmeter</groupId>
    <artifactId>jmeter-maven-plugin</artifactId>
    <version>2.9.0</version>
</dependency>

Tried with changing versions of jmeter maven plugin , still getting same kind of error

This is the error am getting when i run below maven code: mvn clean install -DskipTests -Dskip.report.generation=true -Djmeter.version=5.1.1

[ERROR] Failed to execute goal com.lazerycode.jmeter:jmeter-maven-plugin:2.9.0:jmeter (jmeter-tests) on project WebserviceAutomation: The plugin com.lazerycode.jmeter:jmeter-maven-plugin:2.9.0 requires Maven version 3.5.2
1
Did you tried with Maven version >= 3.5.2?user7294900
I have a doubt here , where do i mention 5.1.1 ? if in POM.xml then yes i mentioned 5.1.1 as shown below : <configuration> <jmeterVersion>5.1.1</jmeterVersion> </configuration> in jmeter maven pluginRahul
5.1.1 is the default versionuser7294900
I'm not getting any error if I just run it through command line using command: mvn clean install. However, no requests are being executed, and build is passed with just 0 requests.CMM

1 Answers

0
votes

As per current version of the JMeter Maven Plugin documentation

The latest version is 2.9.0, it requires Maven >= 3.5.2 and defaults to Apache JMeter 5.1.1.

So make sure to obtain Maven 3.5.2 or just the latest version

The minimal working pom.xml file would be something like:

<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.example</groupId>
    <artifactId>jmeter-maven</artifactId>
    <packaging>jar</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>maven-jmeter-demo</name>
    <url>http://maven.apache.org</url>
    <build>
        <plugins>
            <plugin>
                <groupId>com.lazerycode.jmeter</groupId>
                <artifactId>jmeter-maven-plugin</artifactId>
                <version>2.9.0</version>
                <executions>
                    <!-- Generate JMeter configuration -->
                    <execution>
                        <id>configuration</id>
                        <goals>
                            <goal>configure</goal>
                        </goals>
                    </execution>
                    <!-- Run JMeter tests -->
                    <execution>
                        <id>jmeter-tests</id>
                        <goals>
                            <goal>jmeter</goal>
                        </goals>
                    </execution>
                    <!-- Fail build on errors in test -->
                    <execution>
                        <id>jmeter-check-results</id>
                        <goals>
                            <goal>results</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

Just create src/test/jmeter folder and put your JMX script(s) there, once done you should be able to kick off the tests using mvn verify command

More information: Five Ways To Launch a JMeter Test without Using the JMeter GUI