JMeter Plugins when Executing from Maven

扶醉桌前 提交于 2020-01-01 08:53:11

问题


Is it possible to use JMeter Plugins when executing JMeter from the jmeter-maven-plugin?

UPDATE

I've tried adding the jmeter-plugins dependency to the plugin definition as per Ardesco's helpful answer, but I get a myriad of ClassNotFoundExceptions. It seems like Maven is not putting jmeter-plugin's transitive dependencies on the classpath when executing JMeter. Any ideas?


回答1:


Although this answer is accepted, it only works for versions before 2.X. But for version higher than 2.X, see this answer.

Yup, you can add any libraries you require by adding dependencies to the plugin, any explicitly defined dependencies will be copied to your jmeter/lib directory.

If the dependency is a JMeter plugin you can specify this in your configuration and then that dependency will be copied to your meter/lib/ext directory:

<plugin>
    <groupId>com.lazerycode.jmeter</groupId>
    <artifactId>jmeter-maven-plugin</artifactId>
    <version>1.9.0</version>
    <executions>
        <execution>
            <id>jmeter-tests</id>
            <phase>verify</phase>
            <goals>
                <goal>jmeter</goal>
            </goals>
            <configuration>
                <jmeterPlugins>
                    <plugin>
                        <groupId>kg.apc</groupId>
                        <artifactId>jmeter-plugins</artifactId>
                    </plugin>
                </jmeterPlugins>
            </configuration>
        </execution>
    </executions>
    <dependencies>
        <dependency>
            <groupId>kg.apc</groupId>
            <artifactId>jmeter-plugins</artifactId>
            <version>1.1.3</version>
        </dependency>
    </dependencies>
</plugin>

This functionality was broken before version 1.9.0.




回答2:


Use version 2.6.0 or upper of the plugin

and add:

<configuration>
    <jmeterExtensions>
         <artifacts>kg.apc:jmeter-plugins-casutg:2.4</artifacts>
    </jmeterExtensions>
    <excludedArtifacts>
        <exclusion>commons-pool2:commons-pool2</exclusion>
        <exclusion>commons-math3:commons-math3</exclusion>
    </excludedArtifacts>
    ...
</configuration>

See this tutorial for a complete overview of using the maven plugin :

  • https://www.ubik-ingenierie.com/blog/shift-left-performance-tests-jmeter-maven/


来源:https://stackoverflow.com/questions/18361835/jmeter-plugins-when-executing-from-maven

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!