# Running Gatling as a dependency using Gradle

**URL:** <https://community.gatling.io/t/running-gatling-as-a-dependency-using-gradle/5444>\
**Category:** Gatling (Open-Source)\
**Created:** [January 15, 2020, 5:35am UTC](https://community.gatling.io/t/running-gatling-as-a-dependency-using-gradle/5444 "2020-01-15T05:35:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mark\_Taylor](https://avatars.discourse-cdn.com/v4/letter/m/bc8723/32.png) [@Mark\_Taylor](https://community.gatling.io/u/Mark_Taylor)\
**Post date:** [January 15, 2020, 5:35am UTC](https://community.gatling.io/t/running-gatling-as-a-dependency-using-gradle/5444/1 "2020-01-15T05:35:44Z")

</div>

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](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](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](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](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’,

 ![Screen Shot 2020-01-15 at 4.23.01 pm.png](https://europe1.discourse-cdn.com/flex013/uploads/gatling2/original/1X/863da0ac5227ef794bd6c4b4afbebdbfec0f9f1a.png)

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [January 15, 2020, 6:42am UTC](https://community.gatling.io/t/running-gatling-as-a-dependency-using-gradle/5444/2 "2020-01-15T06:42:02Z")

</div>

[https://gatling.io/docs/current/extensions/#third-parties](https://gatling.io/docs/current/extensions/#third-parties)

---

<div class="post-metadata">

**Author:** ![Mark\_Taylor](https://avatars.discourse-cdn.com/v4/letter/m/bc8723/32.png) [@Mark\_Taylor](https://community.gatling.io/u/Mark_Taylor)\
**Post date:** [January 16, 2020, 6:11am UTC](https://community.gatling.io/t/running-gatling-as-a-dependency-using-gradle/5444/3 "2020-01-16T06:11:24Z")

</div>

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](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](https://www.randstad.com.au/privacy-statement/). If you no longer wish to receive these emails you may [unsubscribe](https://www.randstad.com.au/unsubscribe) at any time. Please allow 48 hours for your request to be activated.

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [January 16, 2020, 7:41am UTC](https://community.gatling.io/t/running-gatling-as-a-dependency-using-gradle/5444/4 "2020-01-16T07:41:13Z")

</div>

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