# Gatling 2 with sbt

**URL:** https://community.gatling.io/t/gatling-2-with-sbt/853
**Category:** Gatling (Open-Source)
**Created:** [March 5, 2014, 11:47pm UTC](https://community.gatling.io/t/gatling-2-with-sbt/853 "2014-03-05T23:47:33Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Nabeel\_Memon](https://avatars.discourse-cdn.com/v4/letter/n/a183cd/32.png) [@Nabeel\_Memon](https://community.gatling.io/u/Nabeel_Memon)
#### Post date: [March 5, 2014, 11:47pm UTC](https://community.gatling.io/t/gatling-2-with-sbt/853/1 "2014-03-05T23:47:33Z")

</div>

I’ve been trying to use sbt 0.13.1 to build and run simulations based on gatling 2.0.0-M3. I found a plugin here [https://github.com/gatling/gatling-sbt](https://github.com/gatling/gatling-sbt) but no documentation on how to actually use it to run a simulation. Any guidelines on that?

---

<div class="post-metadata">

### Author: ![Pierre\_DAL-PRA](https://avatars.discourse-cdn.com/v4/letter/p/ecccb3/32.png) [@Pierre\_DAL-PRA](https://community.gatling.io/u/Pierre_DAL-PRA)
#### Post date: [March 7, 2014, 11:58pm UTC](https://community.gatling.io/t/gatling-2-with-sbt/853/2 "2014-03-07T23:58:26Z")

</div>

Please note that Gatling SBT plugin plugin is currently compatible with snapshots and will be compatible with the upcoming M4.

The plugin is not currently published on Sonatype, I’ll fix that this week end.  
Meanwhile you can build a snapshot if you like.

You’ll need to add the SBT plugin (example here : [https://github.com/gatling/gatling-sbt/blob/master/sbt-test/project/plugins.sbt](https://github.com/gatling/gatling-sbt/blob/master/sbt-test/project/plugins.sbt)) and provided the necessary configuration (example here : [https://github.com/gatling/gatling-sbt/blob/master/sbt-test/project/TestBuild.scala](https://github.com/gatling/gatling-sbt/blob/master/sbt-test/project/TestBuild.scala)).

Please note that you can’t use it with .sbt files currently, you’ll need .scala build files ( .configs(…) is not available in .sbt files).  
This is temporary and this limitation will be dropped as soon as possible.

Basically, Gatling’s SBT plugin allows to use Gatling as a testing framework: you’ll be able to run your simulations with gatling:test, gatling:testOnly, gatling:testQuick… in the same way you would do with any other testing framework.

The plugin also offers two other tasks :

- _gatling:startRecorder_, which launches the Recorder pre-configured to write recorded simulations to your tests sources folder.
- _gatling:lastReport,_ which opens the last generated report in your default web browser

I’ll provide a more detailed documentation this week-end, but this should allow you to start working with Gatling’s SBT plugin 🙂

Cheers,

Pierre

---

<div class="post-metadata">

### Author: ![Nabeel\_Memon](https://avatars.discourse-cdn.com/v4/letter/n/a183cd/32.png) [@Nabeel\_Memon](https://community.gatling.io/u/Nabeel_Memon)
#### Post date: [March 8, 2014, 12:58am UTC](https://community.gatling.io/t/gatling-2-with-sbt/853/3 "2014-03-08T00:58:13Z")

</div>

Awesome. That’s exactly what I was looking for. With a detailed documentation if you put a tiny sbt project with a basic simulation class, it’ll be even more helpful.

---

<div class="post-metadata">

### Author: ![Pierre\_DAL-PRA](https://avatars.discourse-cdn.com/v4/letter/p/ecccb3/32.png) [@Pierre\_DAL-PRA](https://community.gatling.io/u/Pierre_DAL-PRA)
#### Post date: [March 8, 2014, 9:22am UTC](https://community.gatling.io/t/gatling-2-with-sbt/853/4 "2014-03-08T09:22:27Z")

</div>

This tiny sbt project already exists : it’s sbt-test, which can be found in the plugin’s repo : [https://github.com/gatling/gatling-sbt/tree/master/sbt-test](https://github.com/gatling/gatling-sbt/tree/master/sbt-test)

You’ll need to build the plugin first but after that, you can load the sbt-test project and use the plugin right away.

Cheers,

Pierre

---

<div class="post-metadata">

### Author: ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)
#### Post date: [March 8, 2014, 9:53am UTC](https://community.gatling.io/t/gatling-2-with-sbt/853/5 "2014-03-08T09:53:23Z")

</div>

@Pierre: if you don’t mind, I’ll paste parts of this thread in the README file so that people can get a temporary documentation.

---

<div class="post-metadata">

### Author: ![Nabeel\_Memon](https://avatars.discourse-cdn.com/v4/letter/n/a183cd/32.png) [@Nabeel\_Memon](https://community.gatling.io/u/Nabeel_Memon)
#### Post date: [March 8, 2014, 6:11pm UTC](https://community.gatling.io/t/gatling-2-with-sbt/853/6 "2014-03-08T18:11:48Z")

</div>

@Pierre Got it. Thanks.

---

<div class="post-metadata">

### Author: ![Nabeel\_Memon](https://avatars.discourse-cdn.com/v4/letter/n/a183cd/32.png) [@Nabeel\_Memon](https://community.gatling.io/u/Nabeel_Memon)
#### Post date: [March 8, 2014, 7:24pm UTC](https://community.gatling.io/t/gatling-2-with-sbt/853/7 "2014-03-08T19:24:43Z")

</div>

Ok I tried to run a simulation (verified and running with gatling-maven) with gatling-sbt plugin. I got the following exception:

[error] Uncaught exception when running my.MySimulation: java.lang.NoSuchMethodError: io.gatling.app.Gatling$.runGatling([Ljava/lang/String;Lscala/Option;)I

sbt.ForkMain$ForkError: io.gatling.app.Gatling$.runGatling([Ljava/lang/String;Lscala/Option;)I

at io.gatling.sbt.GatlingTask.liftedTree1$1(GatlingTask.scala:22)

at io.gatling.sbt.GatlingTask.execute(GatlingTask.scala:21)

at sbt.ForkMain$Run.runTest(ForkMain.java:243)

at sbt.ForkMain$Run.runTestSafe(ForkMain.java:214)

at sbt.ForkMain$Run.runTests(ForkMain.java:190)

at sbt.ForkMain$Run.run(ForkMain.java:257)

at sbt.ForkMain.main(ForkMain.java:99)

[info] Simulation(s) execution ended.

---

<div class="post-metadata">

### Author: ![Pierre\_DAL-PRA](https://avatars.discourse-cdn.com/v4/letter/p/ecccb3/32.png) [@Pierre\_DAL-PRA](https://community.gatling.io/u/Pierre_DAL-PRA)
#### Post date: [March 8, 2014, 7:34pm UTC](https://community.gatling.io/t/gatling-2-with-sbt/853/8 "2014-03-08T19:34:18Z")

</div>

Are you using the plugin with a snapshot or with 2.0.0-M3a ?  
The SBT plugin required some modifications that are only present in 2.0.0-SNAPSHOT.

---

<div class="post-metadata">

### Author: ![Nabeel\_Memon](https://avatars.discourse-cdn.com/v4/letter/n/a183cd/32.png) [@Nabeel\_Memon](https://community.gatling.io/u/Nabeel_Memon)
#### Post date: [March 8, 2014, 7:35pm UTC](https://community.gatling.io/t/gatling-2-with-sbt/853/9 "2014-03-08T19:35:07Z")

</div>

Yes 2.0.0-SNAPSHOT is not getting resolved at all.

---

<div class="post-metadata">

### Author: ![Pierre\_DAL-PRA](https://avatars.discourse-cdn.com/v4/letter/p/ecccb3/32.png) [@Pierre\_DAL-PRA](https://community.gatling.io/u/Pierre_DAL-PRA)
#### Post date: [March 8, 2014, 7:39pm UTC](https://community.gatling.io/t/gatling-2-with-sbt/853/10 "2014-03-08T19:39:20Z")

</div>

You’ll need to add Sonatype’s snapshots repository to your list of resolvers : [https://oss.sonatype.org/content/repositories/snapshots/](https://oss.sonatype.org/content/repositories/snapshots/) .  
SBT will then be able to resolve Gatling’s snapshots.  
Please note that a lot of stuff has changed since M3a, you’ll probably need to migrate your simulations.

---

<div class="post-metadata">

### Author: ![Nabeel\_Memon](https://avatars.discourse-cdn.com/v4/letter/n/a183cd/32.png) [@Nabeel\_Memon](https://community.gatling.io/u/Nabeel_Memon)
#### Post date: [March 8, 2014, 7:53pm UTC](https://community.gatling.io/t/gatling-2-with-sbt/853/11 "2014-03-08T19:53:51Z")

</div>

Got it done. Luckily I haven’t hit any major incompatibilities so far except this:

not found: value ramp

[error] setUp(scen.inject(nothingFor(2 seconds), ramp(5 users) over (10 seconds))).protocols(httpConf)

[error] ^

Are these changes being documented somewhere?

---

<div class="post-metadata">

### Author: ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)
#### Post date: [March 8, 2014, 7:55pm UTC](https://community.gatling.io/t/gatling-2-with-sbt/853/12 "2014-03-08T19:55:22Z")

</div>

I mentioned this change yesterday on this list.

Basically, we dropped the “users” and “usersPerSec” units.

So, ramp =\> rampUsers or rampUsersPerSec

---

<div class="post-metadata">

### Author: ![Nabeel\_Memon](https://avatars.discourse-cdn.com/v4/letter/n/a183cd/32.png) [@Nabeel\_Memon](https://community.gatling.io/u/Nabeel_Memon)
#### Post date: [March 8, 2014, 7:57pm UTC](https://community.gatling.io/t/gatling-2-with-sbt/853/13 "2014-03-08T19:57:28Z")

</div>

Yeah I changed that to rampUsers and things are fine with this basic simulation. In the meantime, it’ll be great if these changes were aggregated into a small wiki page. Thanks for the plugin.

---

<div class="post-metadata">

### Author: ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)
#### Post date: [March 8, 2014, 7:59pm UTC](https://community.gatling.io/t/gatling-2-with-sbt/853/14 "2014-03-08T19:59:32Z")

</div>

Better than that: we’re moving the doc out of Github wiki.

---

<div class="post-metadata">

### Author: ![Nabeel\_Memon](https://avatars.discourse-cdn.com/v4/letter/n/a183cd/32.png) [@Nabeel\_Memon](https://community.gatling.io/u/Nabeel_Memon)
#### Post date: [March 8, 2014, 8:14pm UTC](https://community.gatling.io/t/gatling-2-with-sbt/853/15 "2014-03-08T20:14:24Z")

</div>

I’m sure it’ll turn out to be better for gatling. I’ve been enjoying every bit of using this project. It should go to masses.

---

<div class="post-metadata">

### Author: ![Joe\_Gaudet](https://avatars.discourse-cdn.com/v4/letter/j/4491bb/32.png) [@Joe\_Gaudet](https://community.gatling.io/u/Joe_Gaudet)
#### Post date: [October 14, 2014, 6:27pm UTC](https://community.gatling.io/t/gatling-2-with-sbt/853/16 "2014-10-14T18:27:32Z")

</div>

Hey I was wondering if there is any update on the status of this plug, and how to get started with it.

I’ve had no luck, and the links to the example projects have moved.

Could someone post an example.sbt and/org .scala configuration with a few simulations in it?

.joe

---

<div class="post-metadata">

### Author: ![Pierre\_DAL-PRA](https://avatars.discourse-cdn.com/v4/letter/p/ecccb3/32.png) [@Pierre\_DAL-PRA](https://community.gatling.io/u/Pierre_DAL-PRA)
#### Post date: [October 14, 2014, 6:31pm UTC](https://community.gatling.io/t/gatling-2-with-sbt/853/17 "2014-10-14T18:31:31Z")

</div>

Hi Joe,

The README on gatling-sbt’s repository includes a setup guide : [https://github.com/gatling/gatling-sbt](https://github.com/gatling/gatling-sbt)

Cheers,

Pierre

---

<div class="post-metadata">

### Author: ![Joe\_Gaudet](https://avatars.discourse-cdn.com/v4/letter/j/4491bb/32.png) [@Joe\_Gaudet](https://community.gatling.io/u/Joe_Gaudet)
#### Post date: [October 14, 2014, 7:18pm UTC](https://community.gatling.io/t/gatling-2-with-sbt/853/18 "2014-10-14T19:18:04Z")

</div>

It’s not super clear. I copied and paste those lines into my .sbt configration and it complained about the .settings call.

When I removed it, the tasks didn’t show up inside of sbt.

You’ll have to forgive me I’m a bit of a noob when it comes to sbt.

.joe

---

<div class="post-metadata">

### Author: ![Pierre\_DAL-PRA](https://avatars.discourse-cdn.com/v4/letter/p/ecccb3/32.png) [@Pierre\_DAL-PRA](https://community.gatling.io/u/Pierre_DAL-PRA)
#### Post date: [October 14, 2014, 7:21pm UTC](https://community.gatling.io/t/gatling-2-with-sbt/853/19 "2014-10-14T19:21:41Z")

</div>

A few things :

- Do you have a build.properties in the project/ folder with _sbt.version=0.13.5_ in it ? Gatling’s SBT plugin is an AutoPlugin, and AutoPlugins require a fairly recent version of SBT
- Did you add the plugin in a project/plugins.sbt file ?
- What does SBT tells you exactly when it failed to load your configuration ?

---

<div class="post-metadata">

### Author: ![Joe\_Gaudet](https://avatars.discourse-cdn.com/v4/letter/j/4491bb/32.png) [@Joe\_Gaudet](https://community.gatling.io/u/Joe_Gaudet)
#### Post date: [October 14, 2014, 7:47pm UTC](https://community.gatling.io/t/gatling-2-with-sbt/853/20 "2014-10-14T19:47:49Z")

</div>

Currently It’s failing in two places.

It appears to have some trouble finding the compiler interface jar (this is from inside intellij)

[warn] Binary version (2.10) for dependency org.scala-lang#scala-compiler;2.10.4  
[warn] in api-stress-test#api-stress-test$sources\_javadoc\_2.11;1.0 differs from Scala binary version in project (2.11).  
[warn] Binary version (2.10) for dependency org.scala-lang#scala-reflect;2.10.4  
[warn] in api-stress-test#api-stress-test$sources\_javadoc\_2.11;1.0 differs from Scala binary version in project (2.11).  
[warn] Binary version (2.10) for dependency org.scala-lang#scala-swing;2.10.4  
[warn] in api-stress-test#api-stress-test$sources\_javadoc\_2.11;1.0 differs from Scala binary version in project (2.11).  
[warn] [FAILED] com.typesafe.sbt#compiler-interface;0.13.5!compiler-interface.jar: (0ms)  
[warn] ==== local: tried  
[warn] /Users/joe/.ivy2/local/com.typesafe.sbt/compiler-interface/0.13.5/jars/compiler-interface.jar  
[warn] ==== public: tried  
[warn] [https://repo1.maven.org/maven2/com/typesafe/sbt/compiler-interface/0.13.5/compiler-interface-0.13.5.jar](https://repo1.maven.org/maven2/com/typesafe/sbt/compiler-interface/0.13.5/compiler-interface-0.13.5.jar)  
[warn] ::::::::::::::::::::::::::::::::::::::::::::::  
[warn] :: FAILED DOWNLOADS ::  
[warn] :: ^ see resolution messages for details ^ ::  
[warn] ::::::::::::::::::::::::::::::::::::::::::::::  
[warn] :: com.typesafe.sbt#compiler-interface;0.13.5!compiler-interface.jar  
[warn] ::::::::::::::::::::::::::::::::::::::::::::::

When I run from the console it spews the following:

=\> Seq[sbt.Def.Setting[\_]]

cannot be applied to (sbt.SettingKey[Seq[sbt.ModuleID]])

.settings(libraryDependencies)

^

sbt.compiler.EvalException: Type error in expression

at sbt.compiler.Eval.checkError(Eval.scala:384)

at sbt.compiler.Eval.compileAndLoad(Eval.scala:183)

[Next page](https://community.gatling.io/t/gatling-2-with-sbt/853.md?page=2)
