This seems like a simple thing, but I can't find an answer in the existing questions:
How do you add a global argument to all your present and existing run or debug configurations? In my case, I need a VM argument, but I see that this could be useful for runline arguments as well.
Basically, every time I create a unit test I need to create a configuration (or run, which creates one), and then manually edit each one with the same VM argument. This seems silly for such a good tool.
This is not true. You can add the VM arguments to the JRE definition. This is exactly what it is for. I use it myself so that assertions are enabled and heap is 1024mb on every run, even future ones.
Ouch: 7-years bug, asking for running configuration template, precisely for that kind or reason.
This thread proposes an interesting workaround, based on duplicating a fake configuration based on string substitution:
- You can define variables in
Window->Preferences->Run/Debug->String Substitution
. For example you can define aprojectName_log4j
variable with the correct-Dlog4j.configuration=...
value.
In a run configuration you can use${projectName_log4j}
and you don't have to remember the real value.- You can define a project-specific "empty" run configuration.
Set the project and the arguments fields in this configuration but not the main class. If you have to create a new run configuration for this project select this one and use 'Duplicate' from its popup-menu to copy this configuration.
You have to simply set the main class and the program arguments.Also you can combine both solutions: use a variable and define an "empty" run configuration which use this variable. The great advantage in this case is when you begin to use a different log4j config file you have to change only the variable declaration.
Not ideal, but it may alleviate your process.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With