tags:

views:

52

answers:

1

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.

+2  A: 

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:

  1. You can define variables in Window->Preferences->Run/Debug->String Substitution. For example you can define a projectName_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.
  2. 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.

VonC
Hrm both solutions are harder than what I do now! I love the end of the bug description where they say it's just too hard to add basic functionality.
orbfish
It's not a good answer for me, but wins by virtue of being the only one ;)
orbfish