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?
Gatling itself uses sbt-native-packager to produce the bundle, you can have a look at we’ve done it:
If you could share a gist of your SBT build, I’ll be happy to help
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
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), 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
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
Hope this helps !
thank you very much for your tips and hints.