Setting VM arguments for any type of execution

Answered

I tried to find a place where I can set some VM arguments which should be used to any type of code I run. Be it Junit test cases or Web Application or anything. 

I tried setting that in JRE but it doesn't take those VM arguments when I run any server or JUnit test case. 

0
11 comments

Set them under the Default configuration node in the Edit Run/Debug configurations dialog. There is no one place for all the run/debug configuration types, therefore you must set it for every configuration which allows it and which you will be using in this project. Now every new configuration you create will inherit these defaults.

0
Avatar
Permanently deleted user

Thanks Serge! 

Frankly speaking, this is very annoying. I really can't think that IntelliJ doesn't have this very simple thing. The time I waste to set my configuration for each and every run is enormous. Why can't IntelliJ have this enhancement? Any specific reason? This is so super simple ask and even Eclipse has it. 

By the way, this default configuration also doesn't work. Could you please point me to some URL which describes this? I tried it but it still doesn't take the default configuration. 

One more thing, where can I create enhancements for improvements?

0

It will work only for the new configurations. For example, you edit the default configuration of Application type, now if you right click in the class file with the main method and choose Run from the context menu, the new run configuration will be created automatically with exactly the same VM Options you have specified for the Default Application configuration. If it doesn't work for you, please provide a short video.

0

> One more thing, where can I create enhancements for improvements?

Here: https://youtrack.jetbrains.com/issues/IDEA

0

We need to run unit tests with several --add-exports VM parameters, otherwise the tests can't even launch. We set the parameters for our saved configurations, but if developers click the green Run arrow next to individual tests or test classes, the temporary configuration doesn't have the required VM parameters.

It sounds like editing the templates would fix this, but I don't see a way to commit the templates to our VCS repository. If every single developer needs to edit templates on their own machine just to be able to run individual tests, that's not a good solution; we need to set default VM parameters for everyone. Is there any solution for this?

0

Hi, I'm already saving run configurations to VCS. I'm talking about saving *templates* to VCS, because we need to set VM arguments for all *temporary* configurations that IntelliJ creates, for ex. when running individual tests or main methods.

As it stands, nobody can run individual tests, because there is no apparent way to push default VM arguments for the configurations created by the green Run button to VCS.

0

Sorry, it seems I didn't express myself correctly. I meant that Run Configuration templates can be saved as project files as well:

Let me know if this is not what you need.

0

I tried that earlier to see if that would work, but nothing changed in .idea/runConfigurations.

0

Ah, it has appeared now. I tried it again before I posted my comment; the creation timestamp of the file is 10:52, so for some reason it took about 3 minutes before the file was created.

0

Please sign in to leave a comment.