Running Gatling as a dependency using Gradle

Using Gatling 3.3.1, I am struggling to find any model project in GitHub or elsewhere that demonstrates running Gatling as a dependency in a Gradle project.
I just want to run my simulations in Jenkins by executing a Gradle task and no matter what I try, Gatling is not able to find my simulations. Running a Gatling project from IntelliJ using Maven is fine but using JavaExec with my build.gradle cannot find my simulations.
Finding a single simulation by full package name is also fine, my issue is just conveying to Gatling via Gradle the folder containing all my simulations.

Using the code below with my simulation in my project at the spot shown in the screenshot, Gatling finds nothing reporting as shown below.
I am new to Gradle and Gatling. I am sure a simple example project would clear this up. I have tried so many variations with sourceSets, configurations, Groovy methods and on but I cannot get this to work.

BUILD.GRADLE

plugins {
id ‘scala’
}

repositories {
jcenter()
}

configurations {
gatling
}

dependencies {
// Use Scala 2.12 in our library project
implementation ‘org.scala-lang:scala-library:2.12.9’

// Use Scalatest for testing our library
testImplementation ‘junit:junit:4.12’
testImplementation ‘org.scalatest:scalatest_2.12:3.0.8’

// Need scala-xml at test runtime
testRuntimeOnly ‘org.scala-lang.modules:scala-xml_2.12:1.2.0’

// https://mvnrepository.com/artifact/io.gatling/gatling-app
compile group: ‘io.gatling’, name: ‘gatling-app’, version: ‘3.3.1’

// https://mvnrepository.com/artifact/io.gatling/gatling-recorder
compile group: ‘io.gatling’, name: ‘gatling-recorder’, version: ‘3.3.1’

// https://mvnrepository.com/artifact/io.gatling/gatling-charts
compile group: ‘io.gatling’, name: ‘gatling-charts’, version: ‘3.3.1’

// https://mvnrepository.com/artifact/io.gatling.highcharts/gatling-highcharts
compile group: ‘io.gatling.highcharts’, name: ‘gatling-charts-highcharts’, version: ‘3.3.1’
}

task gatlingRun(type: JavaExec) {
sourceSets.test.allSource.each {println(it)}
println(“Simulations path: ${projectDir}/src/test/scala”)
description = ‘Run gatling tests’
new File("${buildDir}/reports/gatling").mkdirs()
classpath = sourceSets.test.runtimeClasspath
main = “io.gatling.app.Gatling”
args = [
‘-sf’, “${projectDir}/src/test/scala”,
‘-rf’, “${buildDir}/reports/gatling”
]
}

// ‘-s’, ‘io.monster.tests.load.simulations.feeders.JsonFeederSimulation’,

https://gatling.io/docs/current/extensions/#third-parties

Thanks Stéphane,

Yes I should have mentioned that I tried using the plugin com.github.lkishalmi.gatling and I did not think it was working since, being new to Gradle as well as Gatling, I misunderstood what the plugin does.
I thought the generated tasks would be visible in Gradle after running the plugin.
I finally found a working example of a project which used the plugin and once I had seen how the plugin is used I had another go at using the plugin in a new project. At last that worked correctly for me.

I will create a simple project in GitHub with the plugin, Gradle and Gatling.
The project that helped me was this one: https://github.com/nalinikanth/gattling-gradle-demo

Thanks

Mark

This email was sent to you because you are a candidate that has registered your details with Randstad and/or as a client, referee or supplier you have provided your contact details to us and have consented to receiving communications from Randstad in accordance with our Privacy Collection Statement. If you no longer wish to receive these emails you may unsubscribe at any time. Please allow 48 hours for your request to be activated.

If you’re new with gradle, maybe going with maven that we officially support, would have been a wiser choice.