Developing JMeter plugins using Maven

I have been using JMeter for load testing and I needed to create a custom plugin to handle parsing JSON results but I couldn’t find a simple guide how to do this. I wanted a simple solution that didn’t require manual installation in my repository or a repository manager such as Nexus.

Building the plugin

Building a plugin using maven is easy, simply add the following to your pom:

You probably want to put jmeter.home in your settings.xml instead.

Testing the plugin

Whenever I develop something I want to have a quick build/test cycle. In this case I want to to start the JMeter UI without having to update the JMeter installation or any other manual work. I didn’t get chronos to add my plugin to the UI. It seems chronos copied the jar files to JMETER_HOME/lib/junit and this probably works for running an already created test, but not for creating the test. I also failed to the the maven exec plugin to create the command line arguments I needed. Instead I added a small ant script to start JMeter:

To run the jmeter gui simply run mvn antrun:run. This only works for Windows, I leave other platforms as an exercise to the reader :-).

Using the plugin

I ended up copying the plugin jar and dependencies to the JMeter installation and used then this modified JMeter distribution when performing the tests. The reason was that I didn’t have maven installed on some of the test clients. To copy dependencies you can use mvn dependency:copy-dependencies.
If you want to run JMeter using maven you probably want to look at chronos (although it is not released it seems to work fine):

2 Responses to “Developing JMeter plugins using Maven”

  1. I succeeded, but unfortunately I never got the time to package and release the code.

  2. eBenda says:

    Hi Jan

    Did you succeed to build JSON parser plugin?

    If yes are you will to share it with as, Because I looking for this kind of plugin…

    Thanks
    eBenda

Leave a Reply