Gradle Dependency

hihi,
I’m using Java 17, Gradle 7.5.1, Gatling 3.8.4, Eclipse IDE

I’ve added the Faker library to the build.gradle file:

plugins {
    id 'java'
    id 'io.gatling.gradle' version '3.8.4'
}

gatling {
  logLevel = 'WARN'
  logHttp = 'ALL'

  enterprise {
  }
}

ext {
    logbackVersion = '1.4.5'
}

dependencies {
    implementation "ch.qos.logback:logback-core:$logbackVersion",
            	   "ch.qos.logback:logback-classic:$logbackVersion",
    			   "com.github.javafaker:javafaker:1.0.2"
}

repositories {
  mavenCentral()
}

No issue in IDE, but when I run via cmd
gradle gatlingRun-simulations.SimulationName

for all Faker references I get:
gradle error: package com.github.javafaker does not exist

I’m new to Gradle and any help would be very much appreciated

Do you really use that library in your production code?
Because you declared it as implementation dependency of your production code.
I guess you actually use it in your test code, so you should declare it as testImplementation dependency.

Thanks for replying Bjorn.
I found out what the issue was. I was using the incorrect dependency configuration. I should have mentioned I was using the Gatling Gradle plugin and should have declared the dependency as:
**gatlingImplementation** 'com.github.javafaker:javafaker:1.0.2'

1 Like