How to create a generic launch configuration with Eclipse?
As you are already creating a String Substitution variable, through Run Debug->String Substitution in Eclipse Preferences, to deal with separate paths, you could either:
- Create a variable, e.g.
branch_loc
, with a value of${workspace_loc:/my-project-dev-branch}
- If the paths only differ slightly, e.g. by branch name, then you could create a variable
branch
with a value, e.g.dev
, and then createbranch_loc
with${workspace_loc}\${branch}
Then use ${branch_loc}
for you Maven base directory.
It would be better to have all branches use the same path, which git and mercurial allow you to do. Then you could use ${project_loc}
for your Maven base directory. For project_loc
if you specify the project name of your project, e.g. ${project_loc:MY_PROJECT_NAME}
, then it doesn't require you to select the project in order to work.
If you right click on the project and then select Properties, you can see what ${project_path}
will resolve to by looking at path and what ${project_loc}
will resolve to by looking at location.
First of all, if you are using git as version control system: Do not checkout the project twice, but just switch between branches in a single project. Git was designed for that and can do that in seconds. That way your problem would vanish completely.
If that is not an option, maybe putting the run configuration under version control itself would be an alternative. Set the Shared file option as shown with the first highlight:
Then you can run the run configuration by selecting it in the respective project (as that is really a file there) and launch it via context menu. However, I've never tried this with the same launch configuration checked out twice.
I'm not sure I follow how your branches are represented within the workspace, but
${project_path}
represents a path relative to your workspace${build_project}
will only be set during an actual build (not during an execution of your program)
Based on your description you want to be using ${project_loc}
instead.
Nota: The project MUST be selected in the perspective project before launching the run configuration. Otherwise, you will get a message like in the screenshot below :