intellij-idea

Running Java tests with --add-opens= jvm option in Intellij idea with the green play button


Given tests that need an -add-opens= jvm option. Can the JVM option be set somewhere in Intellij IDEA so it will be present when running an individual test with the green play button without delegating the tests to a build tool?


Solution

  • It seems you want that option set for any test that you run.

    To do that, open the Run/Debug Configurations window (select Edit Configurations from the drop down), click on Edit configuration templates, then add the option to the appropriate kind of configuration (JUnit, TestNG, or whatever is used to run the tests).

    New test runs will use the option, but existing configurations will not be changed.