Troubleshoot running JMeter programmatically

Resolving “Could not find org.apache.jmeter:bom”

With the release of the v5 of the JMeter library comes a bug. When you include JMeter gradle will complain that it “Could not find org.apache.jmeter:bom”. To resolve this, edit build.gradle to say

// There's a bug in JMeter leaving extra metadata right now. This is a workaround
class JMeterRule implements ComponentMetadataRule {
    void execute(ComponentMetadataContext context) {
        context.details.allVariants {
            withDependencies {
                removeAll { == "org.apache.jmeter" && == "bom" }

dependencies {
    implementation group: 'org.apache.jmeter', name: 'ApacheJMeter_core', version: '5.3'
    implementation group: 'org.apache.jmeter', name: 'jorphan', version: '5.3'

    components {
        withModule("org.apache.jmeter:ApacheJMeter_core", JMeterRule)
        withModule("org.apache.jmeter:ApacheJMeter_java", JMeterRule)
        withModule("org.apache.jmeter:ApacheJMeter", JMeterRule)
        withModule("org.apache.jmeter:jorphan", JMeterRule)

Leave a Reply

Your email address will not be published. Required fields are marked *