# Gatling SBT and SBT-Native-Packager

**URL:** <https://community.gatling.io/t/gatling-sbt-and-sbt-native-packager/1174>\
**Category:** Gatling (Open-Source)\
**Created:** [July 15, 2014, 2:03pm UTC](https://community.gatling.io/t/gatling-sbt-and-sbt-native-packager/1174 "2014-07-15T14:03:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nikolaos.tsapanidis](https://avatars.discourse-cdn.com/v4/letter/n/3be4f8/32.png) [@nikolaos.tsapanidis](https://community.gatling.io/u/nikolaos.tsapanidis)\
**Post date:** [July 15, 2014, 2:03pm UTC](https://community.gatling.io/t/gatling-sbt-and-sbt-native-packager/1174/1 "2014-07-15T14:03:29Z")

</div>

Hi,

I’m currently switching from maven to sbt and at the moment I’ve some trouble with the native-packager and gatling-sbt. After compiling and building the package with ‘sbt stage’ I’ve only lib/ directory. My Goal is to have a package with all stuff (simulations, confs,…) so that everyone can execute the simulations. Any experiences/ideas?

Thx  
Niko

---

<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:** [July 15, 2014, 2:54pm UTC](https://community.gatling.io/t/gatling-sbt-and-sbt-native-packager/1174/2 "2014-07-15T14:54:19Z")

</div>

Hi,

Gatling itself uses sbt-native-packager to produce the bundle, you can have a look at we’ve done it:

- [https://github.com/excilys/gatling/blob/master/project/Bundle.scala](https://github.com/excilys/gatling/blob/master/project/Bundle.scala) produces a simple bundle, with the contents of gatling-bundle/src/universal zipped.
- [https://github.com/excilys/gatling-highcharts/blob/master/project/Bundle.scala](https://github.com/excilys/gatling-highcharts/blob/master/project/Bundle.scala) is a bit more complex, as it adds into the lib folder all of Gatling’s dependencies.

If you could share a gist of your SBT build, I’ll be happy to help 🙂

Cheers,

Pierre

---

<div class="post-metadata">

**Author:** ![nikolaos.tsapanidis](https://avatars.discourse-cdn.com/v4/letter/n/3be4f8/32.png) [@nikolaos.tsapanidis](https://community.gatling.io/u/nikolaos.tsapanidis)\
**Post date:** [July 15, 2014, 7:26pm UTC](https://community.gatling.io/t/gatling-sbt-and-sbt-native-packager/1174/3 "2014-07-15T19:26:34Z")

</div>

Hi Pierre,

thanks for the quick response 🙂 and I’ll take a look how you guys solved this.

I would appreciate if you could check my config and give me an advice if it’s ok or if I could improve something. Here is my gist → [https://gist.github.com/anonymous/0545c68566b3f85482bb](https://gist.github.com/anonymous/0545c68566b3f85482bb)

Thx  
Niko

---

<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:** [July 15, 2014, 7:59pm UTC](https://community.gatling.io/t/gatling-sbt-and-sbt-native-packager/1174/4 "2014-07-15T19:59:51Z")

</div>

Hi Niko,

Your config look fine, but I think the "java\_application” built-in is not exactly what you look for.

If I understand your need well, you want to :

- package everything needed to run tests : conf, simulations an all
- put it in a zip, packaged in a way that anyone, maybe not versed in SBT, can run the simulation and read the reports

Basically, what the “java\_application” does is :

- Get all your dependencies in a lib/ folder
- Generate a shell/bat script that can run the main method of your entry point class

Trouble is, there is no main to run in this case !

What you would need is to to setup sbt-native-packager to :

- Add mappings so that your **project** and **test** folders get packaged by sbt-native-packager
- Possibly use Paul Phillip’s script (source here : [https://github.com/paulp/sbt-extras/blob/master/sbt](https://github.com/paulp/sbt-extras/blob/master/sbt)), that fetches the right version of SBT launcher, so that no prior installation of SBT is required
- Eventually, if you need to make the simulation running as smooth as possible, write a small script that just run “sbt gatling:test”.

I suggest that you use the “Universal” configuration, which offers you tasks to create .zip and .tar.gz archives, except if you have needs to build .deb/.rpm/.msi packages.

Adding mappings is not hard, you have a example here : [https://github.com/excilys/gatling-highcharts/blob/master/project/Bundle.scala#L25-L27](https://github.com/excilys/gatling-highcharts/blob/master/project/Bundle.scala#L25-L27)

Your scripts would go to **/src/universal** , which is included by default in the archive/package produced by the plugin.

You basically add pairs to **mappings in Universal** to tell the plugin what (the pair’s first element) goes where (the pair’s second element).

If you need info on the specifics of building .deb/.rpm/.msi packages, sbt-native-packager documentation provides help for each type of package : [http://www.scala-sbt.org/sbt-native-packager/DetailedTopics/index.html](http://www.scala-sbt.org/sbt-native-packager/DetailedTopics/index.html)

Hope this helps !

Cheers,

Pierre

---

<div class="post-metadata">

**Author:** ![nikolaos.tsapanidis](https://avatars.discourse-cdn.com/v4/letter/n/3be4f8/32.png) [@nikolaos.tsapanidis](https://community.gatling.io/u/nikolaos.tsapanidis)\
**Post date:** [July 16, 2014, 12:26pm UTC](https://community.gatling.io/t/gatling-sbt-and-sbt-native-packager/1174/5 "2014-07-16T12:26:31Z")

</div>

Hi Pierre,

thank you very much for your tips and hints.

Greetings  
Niko
