How to bundle my Maven based gatling loadtest into one JAR?

622 views
Skip to first unread message

Ingo Jaeckel

unread,
Jan 8, 2015, 2:53:27 PM1/8/15
to gat...@googlegroups.com

[Also posted on http://stackoverflow.com/questions/27847999/how-to-bundle-my-maven-based-gatling-loadtest-into-one-jar]

I created a Gatling load test using the highcharts archetype. I decided against just downloading the latest Gatling ZIP file and creating a simulation within the extracted folder since I rely on a number of dependencies in public and private Maven repositories.

I want to

  1. bundle my simulation and all its dependencies into a single JAR,
  2. distribute the JAR to multiple load generators in EC2/GCE, and
  3. start the test on all remote load generators.

Maven's assembly plugin looks like an obvious candidate to solve #1. So I added the following to my pom.xml:

<plugin>
  <artifactId>maven-assembly-plugin</artifactId>
  <configuration>
    <archive>
      <manifest>
        <mainClass>io.gatling.app.Gatling</mainClass>
      </manifest>
    </archive>
    <descriptorRefs>
      <descriptorRef>jar-with-dependencies</descriptorRef>
    </descriptorRefs>
  </configuration>
</plugin>

With this configuration, running a JAR file created with mvn clean package assembly:single results in the following NoSuchFileException:

$ java -jar target/myapp-0.1-SNAPSHOT-jar-with-dependencies.jar
Exception in thread "main" java.nio.file.NoSuchFileException: ./target/test-classes
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
at sun.nio.fs.UnixFileSystemProvider.newDirectoryStream(UnixFileSystemProvider.java:407)
at java.nio.file.Files.newDirectoryStream(Files.java:457)
at io.gatling.core.util.PathHelper$RichPath$.deepListAux$1(PathHelper.scala:99)
at io.gatling.core.util.PathHelper$RichPath$.deepList$extension(PathHelper.scala:105)
at io.gatling.core.util.PathHelper$RichPath$.deepFiles$extension(PathHelper.scala)
at io.gatling.app.classloader.SimulationClassLoader.simulationClasses(SimulationClassLoader.scala:55)
at io.gatling.app.Gatling.loadSimulations(Gatling.scala:92)
at io.gatling.app.Gatling.start(Gatling.scala:70)
at io.gatling.app.Gatling$.fromArgs(Gatling.scala:59)
at io.gatling.app.Gatling$.main(Gatling.scala:44)
at io.gatling.app.Gatling.main(Gatling.scala)
  • Is this how I should bundle up my Maven based Gatling project?
  • Have I misconfigured Gatling's Maven plugin at the time the JAR file is created?
Thanks,
Ingo

Stéphane Landelle

unread,
Jan 9, 2015, 10:38:48 AM1/9/15
to gat...@googlegroups.com
Hi,

We don't support this set up.
You can pre-compile your simulations are ship them altogether with their resources (bodies, feeders) and their specific dependencies in a single jar.
But you can't repackage Gatling.

--
You received this message because you are subscribed to the Google Groups "Gatling User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gatling+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ingo Jaeckel

unread,
Jan 9, 2015, 11:57:03 AM1/9/15
to gat...@googlegroups.com
Hey Stéphane,

thank you very much!

Can you clarify if you are suggesting the following:
  1. Use the maven assembly plugin to create a single JAR with all dependencies - This part already works.
  2. Precompile the simulations  - How can I do that? Are you suggesting to precompile them with scalac directly or do I need to invoke zinc (which would normally be invoked by Gatling)?
  3. Run the precompiled simulation and add the single JAR to the class path. Do you mind outlining the details on that? E.g. would I customize the gatling.sh script out of the Gatling's ZIP distribution to specify the precompiled simulations and the modified classpath?
Thanks,
Ingo

--
You received this message because you are subscribed to a topic in the Google Groups "Gatling User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gatling/hswDBVi3bsU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gatling+u...@googlegroups.com.

Excilys

unread,
Jan 9, 2015, 2:08:28 PM1/9/15
to gat...@googlegroups.com
1. Not exactly. It seems you ship all Gatling deps, which you shouldn't. Only ship non Gatling libs.

2. Use the scala-maven-plugin

3. Just deploy in the lib folder.


Excilys

unread,
Jan 9, 2015, 2:26:39 PM1/9/15
to gat...@googlegroups.com
1. Not exactly. It seems you ship all Gatling deps, which you shouldn't. Only ship non Gatling libs.

2. Use the scala-maven-plugin

3. Just deploy in the lib folder.



Le 9 janv. 2015 à 17:57, Ingo Jaeckel <ingo.j...@gmail.com> a écrit :

Reply all
Reply to author
Forward
0 new messages