jvmArgs doesnt work with gradle plugin

I made sure I’ve update my Gatling version to the latest release
I read the guidelines and how to ask a question topics.
I provided a SSCCE (or at least, all information to help the community understand my topic)
I copied output I observe, and explain what I think should be.

gatling-gradle-plugin: 3.15.1

My test is throwing NullPointer exceptions and I cant figure out why. I need it to pause the simulation at startup so that I can attach a debugger. However I am unable to do that.
This is what I have tried and the results.

  1. Passing in JAVA_OPTS before gradle. This just attaches to gradle, not the actual simulation

JAVA_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005" ./gradlew gatlingRun ....

  1. Adding jvmArgs to gatling closure does not work.
gatling {

jvmArgs [ "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005" ]

}

This gives

> Exception evaluating property '-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005' for java.util.Collections$UnmodifiableRandomAccessList, Reason: groovy.lang.MissingPropertyException: No such property: -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005 for class: java.lang.String


  1. Passing in jvmArgs on command line
./gradlew gatlingRun --simulation <sim> --jvmArgs "agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005"


This gives:

No argument was provided for command-line option '-g'.

USAGE: gradlew [option...] [task...]

-?, -h, --help                     Shows this help message.


Please tell me how to get the simulation to pause at startup.

@slandelle can you take a look ?

  1. Adding jvmArgs to gatling closure does not work.

Wrong groovy usage. Without a =, it’s a method call, not an assignation = > jvmArgs = ...

  1. Passing in jvmArgs on command line

Wrong gradle usage, missing a = for between the option name and value. But I think it won’t work anyway as jvmArgs is not a valid option for this task. Can’t check, I’m currently off.