how to add custom class for JSR223 sampler?

441 views
Skip to first unread message

Spencer Haney

unread,
Sep 4, 2020, 2:19:50 PM9/4/20
to Maven JMeter Plugin Users
hi all - this likely is answered somewhere but I've been unable to find an example.

I have a project structure as follows:

/src/main/java/<custom class>
/src/test/jmeter/<jmeter test.jmx>

my custom class is used by a JSR223 groovy sampler.  I'm able to package my custom class into a jar, but I can't figure out how to include this as a dependency to my jmeter project, by adding either to the /lib directory or lib/ext directory.

I am able to successfully include 3rd party artifacts by specifying as <jmeterExtensions>, and i can see where these are successfully landing in the target jmeter/lib/ext path.

Can anybody share an example pom where a custom jar is first built, then added to the jmeter classpath?

Philippe Mouawad

unread,
Sep 4, 2020, 4:58:37 PM9/4/20
to maven-jmeter...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "Maven JMeter Plugin Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to maven-jmeter-plugi...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/maven-jmeter-plugin-users/8d801d34-5fc6-4afd-bb4d-94ce95caf42an%40googlegroups.com.


--
Cordialement.
Philippe Mouawad.


Spencer Haney

unread,
Sep 6, 2020, 3:42:21 PM9/6/20
to Maven JMeter Plugin Users
thank you Philippe for the reply. 


turns out my issue was more due to my not really understanding how maven works.  I had to include my custom class in a separate module.  only then was the jmeter plugin able to identify the artifact.

in hopes in might help somebody else, here is the structure of my project now.  the verify stage now builds my custom class and the corresponding jar is added to jmeter's lib/ext directory.  script runs successfully!

- project

        - module 1
            /src/main/java/<custom class>
        - pom.xml

        - module 2
            /src/test/jmeter/<jmeter test.jmx>
        - pom.xml (with dependency on artifact from module 1, then add the artifact to  <jmeterExtensions> in the jmeter-maven-plugin config settings)

- parent pom.xml

Reply all
Reply to author
Forward
0 new messages