mavenjmeterjmeter-pluginsjmeter-maven-plugin

JMeter maven plugin - Customize reportgenerator.properties


When I'm using the JMeter Maven plugin, and running mvn jmeter:configure it automatically creates a default bin/reportgenerator.properties file.

How can I customize this file? Is there a way to specify some of the properties in the jmeter-maven plugin configuration so that I can set, for example, report_title?

See: https://jmeter.apache.org/usermanual/generating-dashboard.html


Solution

  • See Modifying Properties chapter of JMeter Maven Plugin wiki.

    You need to add the following block to your <plugin> section:

    <configuration>
        <propertiesUser>
            <jmeter.reportgenerator.report_title>your-custom-title</jmeter.reportgenerator.report_title>
        </propertiesUser>
    </configuration>
    

    Full pom.xml just in case:

    <?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/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
    
        <groupId>org.example</groupId>
        <artifactId>jmeter-maven</artifactId>
        <version>1.0-SNAPSHOT</version>
    
        <properties>
            <maven.compiler.source>8</maven.compiler.source>
            <maven.compiler.target>8</maven.compiler.target>
        </properties>
    
        <build>
            <plugins>
                <plugin>
                    <groupId>com.lazerycode.jmeter</groupId>
                    <artifactId>jmeter-maven-plugin</artifactId>
                    <version>3.4.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>
                    <configuration>
                        <propertiesUser>
                            <jmeter.reportgenerator.report_title>your-custom-title</jmeter.reportgenerator.report_title>
                        </propertiesUser>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    
    </project>
    

    More information: How to Use the JMeter Maven Plugin