Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Global launch configuration in Eclipse?

Tags:

eclipse

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.

like image 585
orbfish Avatar asked Jun 29 '10 15:06

orbfish


2 Answers

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.

like image 185
alice Avatar answered Sep 22 '22 09:09

alice


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.

like image 35
VonC Avatar answered Sep 21 '22 09:09

VonC