Gatling Maven throws exception if given -Dgatling.simulation

I checked out the gatling maven demo project and run the gatling:execute goal with gatling.simulation argument, but get the following exception. Did I do anything wrong?

mvn gatling:execute -Dgatling.simulation=basic.BasicExampleSimulation
[INFO] Scanning for projects…
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building gatling-maven-plugin-demo 1.4.5
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] — gatling-maven-plugin:1.4.5:execute (default-cli) @ gatling-maven-plug
in-demo —
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at scala_maven_executions.MainHelper.runMain(MainHelper.java:164)
at scala_maven_executions.MainWithArgsInFile.main(MainWithArgsInFile.jav
Caused by: com.typesafe.config.ConfigException$WrongType: system properties: gat
ling.simulation has type STRING rather than OBJECT
at com.typesafe.config.impl.SimpleConfig.findKey(SimpleConfig.java:124)
at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:138)
at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:142)
at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:150)
at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:155)
at com.typesafe.config.impl.SimpleConfig.getString(SimpleConfig.java:197
)
at com.excilys.ebi.gatling.core.config.GatlingConfiguration$.setUp(Gatli
ngConfiguration.scala:46)
at com.excilys.ebi.gatling.app.Gatling$.fromMap(Gatling.scala:53)
at com.excilys.ebi.gatling.app.Gatling$.runGatling(Gatling.scala:73)
at com.excilys.ebi.gatling.app.Gatling$.main(Gatling.scala:49)
at com.excilys.ebi.gatling.app.Gatling.main(Gatling.scala)
… 6 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.856s
[INFO] Finished at: Sat Mar 23 04:42:16 PDT 2013
[INFO] Final Memory: 6M/184M
[INFO] ------------------------------------------------------------------------

Funny one.
That’s a naming conflict.

Here’s what happens:

  • you’re passing -Dgatling.simulation in order to configure the target simulation from the command line instead of setting up statically in the pom.xml (perfect use case)
  • the gatling maven plugin default behavior is fork + propagateSystemProperties, so the system property gatling.simulation is propagated to the forked JVM that will run Gatling
  • the configuration framework let one override the configuration file with System properties, the problem is that it expects gatling.simulation to be an Object (see gatling.conf file) and not a String
    I guess the only proper solution is to change/translate the gatling-maven-plugin properties so that they can never conflict with the main engine ones.

As a workaround, you can:

  • disable propagateSystemProperties, see https://github.com/excilys/gatling/wiki/Maven-plugin#wiki-advanced. However, depending on your use case, you might need to propagate them.
  • don’t set up directly maven plugin gatling.simulation property, but its value. I think something like this might work (haven’t tested, please let me know:
    mvn gatling:execute -Dfoo=basic.BasicExampleSimulation
${foo}

Cheers,

Stéphane

Thanks for prompt reply. I will definitely give it a try and let you
know :). It's 5 AM here now, so I will defer the task until later.

Cheers,
Alvin

Good night, then! :slight_smile:

${foo}

actually works :slight_smile:

Glad to hear, thanks for your feedback.

We’ve had to rename the property from “simulation” to “simulationClass” in 1.4.6 in order to avoid the clash.
Be aware of this when upgrading.

Cheers,

Stéphane