skip to content

Goals and Task Names

The exact goal, task or command each build tool exposes to launch a simulation, plus where gatling.conf has to sit and how the run picks a class when a project holds several simulations.

on this pageshow

explore

questions

6

Which command launches a Gatling simulation under Maven, Gradle, sbt and the JavaScript CLI, and how do the four names differ?

level: juniorimportance: must knowfreq 70%

answer

  1. Four build tools, four different names
  2. Maven goals, Gradle tasks, sbt prefix
  3. gatling:test, gatlingRun, Gatling/testOnly, npx gatling run
  4. sbt plugin accepts Scala simulations only

basics

~20 s

Maven runs mvn gatling:test, Gradle runs ./gradlew gatlingRun, sbt runs sbt Gatling/testOnly with a class pattern, and the JavaScript CLI runs npx gatling run. Each build tool names its own entry point; there is no shared Gatling command.

solid answer

~50 s

There is no single Gatling command — each build-tool integration names its own. The Maven plugin exposes goals under a `gatling:` prefix, so you run `mvn gatling:test`. The Gradle plugin exposes camel-case tasks, so you run `./gradlew gatlingRun`. The sbt plugin puts everything behind a `Gatling` configuration prefix, so you run `sbt Gatling/testFull` for all simulations or `sbt 'Gatling/testOnly com.project.simu.MySimulation'` for one. The JavaScript/TypeScript SDK ships an npm CLI instead, run as `npx gatling run`. The sbt plugin supports Scala simulations only, so Java and Kotlin projects must use Maven or Gradle. Underneath all four sits the same JVM entry point, `io.gatling.app.Gatling`, which takes `--simulation <className>` (short `-s`) and refuses to *run a simulation* without one — it does no discovery of its own. The one mode that needs no simulation class is `--reports-only <runId>` (short `-ro`), which skips the runner entirely and only regenerates the HTML report from an existing run's log file.

code

bash · 11 lines
bash
# Maven: a goal under the gatling: prefix
mvn gatling:test

# Gradle: a camel-case task, no colon
./gradlew gatlingRun

# sbt: everything behind the Gatling configuration prefix (Scala only)
sbt 'Gatling/testOnly com.project.simu.MySimulation'

# JavaScript/TypeScript: the @gatling.io/cli npm package
npx gatling run

go deeper

for a junior

Be ready to name the launch command for whichever build tool the job uses: mvn gatling:test, ./gradlew gatlingRun, sbt Gatling/testOnly, npx gatling run.

for a middle

Explain that each plugin layers simulation discovery and prompting on top of io.gatling.app.Gatling, whose own command line simply demands a class name before it will run one - the only mode that needs no simulation class is --reports-only, which just regenerates a report.

for a senior

Show that you verify the launch command in a pipeline: a wrong task name can pass green while never running the load test at all.

for a principal

Own which build tool the estate standardises on, knowing sbt takes Scala only and that the Maven plugin has not compiled Scala since version 4.

Gatling does not ship one universal "run" command. Each build tool has its own Gatling plugin, and each plugin follows its **host tool's** naming convention rather than a Gatling-wide one. Knowing which name belongs to which tool is the difference between a pipeline that runs your load test and one that silently runs nothing. ## The common core underneath Every launcher ends in the same place: `io.gatling.app.Gatling`, an ordinary JVM main class. Its command-line surface is deliberately tiny, and the option that matters here is `--simulation` (short `-s`), which names the simulation class to run. It does **not** search for simulations: on the run path, when no class name was supplied the selection step throws `IllegalArgumentException("Missing simulation class")`, and if the class it was handed does not extend a Gatling `Simulation` it throws again. That refusal is scoped to running a simulation, not to starting the process. `--reports-only <runId>` (short `-ro`) is checked first and short-circuits the runner entirely, so it never reaches the selection step: pointed at a results directory with `--results-folder <dir>`, it re-reads an existing run's log file and regenerates that run's HTML report with no simulation class at all. Generating the reports for a run that already happened is the option's whole job. Everything friendlier than that — scanning the compiled output for simulation classes, prompting you to pick one, defaulting to the only one present — is added by the **build-tool plugin**, not by Gatling's core. That is why the ergonomics differ per tool even though the runtime is identical. ## The four names, side by side | Tool | Launch a simulation | Naming shape | |---|---|---| | Maven | `mvn gatling:test` | `gatling:` prefix plus a camel-case goal | | Gradle | `./gradlew gatlingRun` | a `gatling`-prefixed camel-case task | | sbt | `sbt 'Gatling/testOnly com.project.simu.MySimulation'` | a `Gatling/` configuration prefix on a standard sbt task | | JavaScript / TypeScript | `npx gatling run` | an npm CLI with kebab-case subcommands | ### Maven The `gatling-maven-plugin` publishes the goals `test`, `recorder`, `enterprisePackage`, `enterpriseDeploy`, `enterpriseStart` and `help`; `mvn gatling:help -Ddetail=true -Dgoal=test` prints every configuration option on the `test` goal. Two things trip people up: 1. Plain `mvn test` does **not** run simulations. `gatling:test` is a direct goal invocation. You only reach it from a phase if you add an `<execution>` block, in which case `test` is bound to `integration-test` and `enterprisePackage` to `package` by default. 2. From version 4 the plugin no longer compiles Scala, so a Scala project must also configure `scala-maven-plugin`. ### Gradle The `io.gatling.gradle` plugin registers `gatlingRun`, `gatlingRecorder`, `gatlingEnterprisePackage`, `gatlingEnterpriseDeploy` and `gatlingEnterpriseStart`. There is no colon — Gradle has tasks, not goals. `gatlingRun` accepts `--simulation <FullyQualifiedClassName>` to force one simulation and `--all` to run every discovered simulation sequentially in alphabetic order. ### sbt The `gatling-sbt` plugin registers a custom sbt configuration named `Gatling`, so every task is prefixed with it. `sbt Gatling/testFull` runs all simulations and `sbt 'Gatling/testOnly com.project.simu.MySimulation'` runs one by fully qualified class name. Be careful with the bare `test` task: in sbt 1.x `test` ran everything and `testQuick` ran only what had changed, while sbt 2.x renamed those to `testFull` and `test` respectively. `testOnly` means the same in both. The plugin also offers `Gatling/startRecorder`, `Gatling/generateReport`, `Gatling/lastReport`, `Gatling/copyConfigFiles` and `Gatling/copyLogbackXml`. Its hard limit is the one to remember: **it supports simulations written in Scala only.** Java or Kotlin means Maven or Gradle. ### JavaScript and TypeScript Here the launcher is not a build-tool plugin at all but an npm package, `@gatling.io/cli`, invoked through `npx gatling`. Its subcommands are kebab-case: `run`, `recorder`, `install`, `enterprise-package`, `enterprise-deploy`, `enterprise-start`. `npx gatling run` looks for simulations under `src` and writes its report into `target/gatling`. ## Where the names stop matching - `--simulation` exists on both `gatlingRun` and `npx gatling run`, but they take different things: Gradle wants a fully qualified **class name**, the JavaScript CLI wants the simulation's **name**, so `--simulation "my-simulation"` matches `src/my-simulation.gatling.ts`. - Maven has no `--simulation` flag at all. It uses the Java system property `-Dgatling.simulationClass=<FullyQualifiedClassName>` or a `<simulationClass>` element in the plugin's `<configuration>`. - Only Gradle documents a run-everything switch, `--all`. sbt achieves the same with `Gatling/testFull`, and `mvn gatling:test` runs exactly one simulation per invocation. - The Recorder is `gatling:recorder`, `gatlingRecorder`, `Gatling/startRecorder` and `npx gatling recorder` — four spellings of one tool. ## Why this matters in a pipeline A job that types the wrong name does not always fail loudly. Maven will report an unknown goal, but a Gradle build that runs `gradle test` instead of `gradle gatlingRun` happily runs the unit tests, reports success and never touches the load test. Treat the launch command as part of the contract between the repository and the pipeline: write it down once, in the build file or in a documented command, rather than retyping it in every job.

  • Why can a Kotlin Gatling project not use the sbt plugin?
    The gatling-sbt plugin supports simulations written in Scala only, and Gatling's documentation sends Java and Kotlin authors to the Maven or Gradle plugin instead. Kotlin sits on Gatling's Java API, which those two plugins compile and put on the run classpath.
  • What does `mvn gatling:help -Ddetail=true -Dgoal=test` print?
    The description of every configuration option available on the Maven plugin's `test` goal. `help` is one of the plugin's own goals, alongside `test`, `recorder`, `enterprisePackage`, `enterpriseDeploy` and `enterpriseStart`.
  • Which command starts the Gatling Recorder under each build tool?
    `mvn gatling:recorder`, `./gradlew gatlingRecorder`, `sbt Gatling/startRecorder`, or `npx gatling recorder`. One tool, four spellings, each following its host build tool's naming convention.

saying these in an interview costs you the question

  • Believing plain mvn test runs Gatling simulations without an execution binding
  • Assuming Gradle uses the same gatling: goal prefix as Maven
  • Expecting the sbt plugin to launch Java or Kotlin simulations
  • Thinking one command line works across all four build tools
open as a page

A Maven project holds three Gatling simulation classes, and mvn gatling:test fails on the CI runner because more than one simulation is available - how do you make the job run the one you want?

level: middleimportance: must knowfreq 58%

basics

~10 s

Force the class. Pass -Dgatling.simulationClass=com.project.simu.CheckoutSimulation on the mvn command line, or set a simulationClass element in the plugin configuration. Under CI the goal deliberately refuses to guess when several simulations exist.

open as a page

Where must a gatling.conf file sit for a Gatling run to pick it up, and what does the -Dgatling.conf.file system property actually change?

level: middleimportance: should knowfreq 42%

basics

~10 s

On the classpath: src/test/resources in a Maven or sbt project, src/gatling/resources in a Gradle one. The gatling.conf.file property changes only the resource name Gatling looks up, never a directory or a filesystem path.

open as a page

In a Gradle build using the io.gatling.gradle plugin, which dependency configuration makes a library visible to your simulations, and where does the plugin expect the simulation sources?

level: middleimportance: should knowfreq 36%

basics

~20 s

Declare it in gatlingImplementation, or in gatling, or in gatlingRuntimeOnly. Dependencies added to any other configuration are not available to simulations. Sources live in the gatling source set: src/gatling/java, kotlin or scala, with resources in src/gatling/resources.

open as a page

As a Gatling repository grows from one simulation to a dozen, how would you decide what each pipeline job actually launches?

level: principalimportance: should knowfreq 30%

basics

~20 s

Decide between pinning one simulation class per job and running the whole set. Pinning is explicit but leaves new simulations unrun; running everything is a documented option only on Gradle and sbt, and job time grows with each addition.

open as a page

Since Gatling 3.13 a run needs the JVM option --add-opens=java.base/java.lang=ALL-UNNAMED - when do you have to supply it yourself?

level: seniorimportance: nice to knowfreq 22%

basics

~20 s

Whenever the JVM is not launched by a recent Gatling plugin. gatling-maven-plugin 4.11.0, gatling-gradle-plugin 3.13.1 and gatling-sbt 4.10.2 set it by default; supply it yourself for a hand-rolled java command, an IDE run configuration, or a replaced jvmArgs list.

open as a page