Skip to content

Adding additional libraries to the classpath

Mark Collin edited this page Jan 23, 2014 · 5 revisions

Adding jar's to the /lib directory

You can add any additional Java libraries to the classpath by using the standard Maven functionality to add dependecies to the plugin, these will be copied to JMeter's /lib directory.

+---+
<project>
    [...]
        <build>
            <plugins>
                <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>
                        </execution>
                    </executions>
                    <dependencies>
                        <dependency>
                            <groupId>org.apache.tomcat</groupId>
                            <artifactId>tomcat</artifactId>
                            <version>7.0.50</version>
                        </dependency>
                    </dependencies>
                </plugin>
            </plugins>
        </build>
    [...]
</project>
+---+

Adding jar's to the /lib/ext directory

If the dependency that you have added is a JMeter plugin that should reside in the lib/ext directory you will need to explicitly specify this with the <jmeterPlugins> configuration setting (please note that the tag name is not related to the artefact that we are adding)

For example you could add the JMeter Plugins library by doing the following:

+---+
<project>
    [...]
        <build>
            <plugins>
                <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.0.0</version>
                        </dependency>
                    </dependencies>
                </plugin>
            </plugins>
        </build>
    [...]
</project>
+---+