Debugging through Maven (IntelliJ IDEA) does not work

Gatling version:
Gatling flavor: java
Gatling build tool: maven

I followed the directions to set up a run configuration in IntelliJ:

The VM option –add-opens=java.base/java.lang=ALL-UNNAMED does not work at all. If I run the Maven configuration with this setting I get the following error:

/bin/sh /Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/bin/mvn -Didea.version=2025.2 -Dmaven.ext.class.path=/Applications/IntelliJIDEA.app/Contents/plugins/maven/lib/maven-event-listener.jar -Djansi.passthrough=true -Dstyle.color=always --add-opens=java.base/java.lang=ALL-UNNAMED gatling:test -Dgatling.sameProcess=trueUnable to parse command line options: Unrecognized option: --add-opens=java.base/java.lang=ALL-UNNAMED
usage: mvn [options] [<goal(s)>] [<phase(s)>]

If I remove that VM option, I can run my Gatling test, but the debugger does not stop at my breakpoints at all. Can I get help in how to get this working?

Regarding `Unable to parse command line options: Unrecognized option: --add-opens=java.base/java.lang=ALL-UNNAMED`, I can only think of 2 possible sane explanations:

  1. your `temurin-21` is actually NOT Java 21 => verify the Java installation it points to
  2. you have some non printable character in your input => clean the “Run“ and “VM options“ input fields and fill them again manually, character by character

I can run my Gatling test, but the debugger does not stop at my breakpoints at all

Make sure you use up-to-date Gatling and gatling-maven-plugin versions.

`Unable to parse command line options: Unrecognized option: --add-opens=java.base/java.lang=ALL-UNNAMED

It’s a regression in IntelliJ IDEA 2025.2. VM options are currently broken, see https://youtrack.jetbrains.com/projects/IDEA/issues/IDEA-377059/Maven-vm-options-not-recognized-correctly.

I can confirm that updating my pom.xml to use the pom from the Java example project (which among other things upgrade Gatling to the latest version) fixes the issue with the debugger.

I’m seeing breakpoints being hit during scenario setup:

However, when I actually try to run the scenario (the setUp function), I get the following exception:

[ERROR] Failed to execute goal io.gatling:gatling-maven-plugin:4.20.1:test (default-cli) on project publisher-perf-tests: Gatling failed.: InvocationTargetException: module java.base does not open java.lang to unnamed module @2d683b2d -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Disconnected from the target VM, address: '127.0.0.1:57164', transport: 'socket'

@omair Please read my previous messages about the IntelliJ IDEA bug. You NEED this VM option.
If you want to make things work, you must either restore a previous version of IDEA, or wait for the fix.

1 Like

I can confirm that after

  • downgrading to IntelliJ IDEA Ultimate 2025.1.4.1 and
  • adding the VM option --add-opens=java.base/java.lang=ALL-UNNAMEDto the run configuration

I am able to set fully functioning breakpoints within the scenario script.

Thanks @slandelle !

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.