How to override arguments via jmeter-maven-plugin?

603 views Asked by At

I have the following configuration for jmeter maven plugin:

            <plugin>
                <groupId>com.lazerycode.jmeter</groupId>
                <artifactId>jmeter-maven-plugin</artifactId>
                <version>3.4.0</version>
                <executions>
                    <execution>
                        <id>configuration</id>
                        <goals>
                            <goal>configure</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>jmeter-tests</id>
                        <goals>
                            <goal>jmeter</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <jMeterProcessJVMSettings>
                        <arguments>
                            <argument>-Djavax.net.ssl.keyStore=${keyStore.file}</argument>
                            <argument>-Djavax.net.ssl.keyStorePassword=${keyStore.pass}<argument>
                        </arguments>
                    </jMeterProcessJVMSettings>
                        <testFilesIncluded>
                            <jMeterTestFile>${jmeter.project}</jMeterTestFile>
                        </testFilesIncluded>
                </configuration>
            </plugin>

I am trying to run mvn jmeter:jmeter -Djavax.net.ssl.keyStore=file.jks -Djavax.net.ssl.keyStorePassword=pass -Djmeter.project=test1.jmx but it can not override the properties defined in pom. Is there a possible solution?

Thanks in advance!

1

There are 1 answers

0
Dmitri T On

You need to define the properties in your pom.xml file:

<properties>
    <keyStore.file>/path/to/your/keystore</keyStore.file>
    <keyStore.pass>your_password</keyStore.pass>
    <jmeter.project>/path/to/jmx/script</jmeter.project>
</properties>

Once done you will be able to refer the properties in the JMeter Maven plugin:

<configuration>
    <jMeterProcessJVMSettings>
        <arguments>
            <argument>-Djavax.net.ssl.keyStore=${keyStore.file}</argument>
            <argument>-Djavax.net.ssl.keyStorePassword=${keyStore.pass}</argument>
        </arguments>
    </jMeterProcessJVMSettings>
    <testFilesIncluded>
        <jMeterTestFile>${jmeter.project}</jMeterTestFile>
    </testFilesIncluded>
</configuration>

and the default values specified via the <properties> block can be overriden via -D command-line argument

More information: How to Use the JMeter Maven Plugin