How can I have per project Debug Configuration in Eclipse? - eclipse

I have configured some VM arguments inside the Debug Configuration. However, these settings are saved in .metadata\.plugins\org.eclipse.debug.core\.launches\Program.launch, which is outside the version control. Indeed, the whole .metadata folder is.
But this is something I wish to be shared amongst all the devs working on the project. In other words, I want per project Debug/Run Configuration.
Is it possible?

The launcher (.launch file) can be stored outside of .metadata: go to "Run → Run Configurations...", choose your launcher, and in its "Common" tab choose "Save as: Shared file". This will save the .launch file in the chosen folder, and then it can be committed to your version control system.

Related

What is the runtime-EclipseApplication folder for, and can I delete it safely?

I'm trying to organise the directory structure of my projects' source code and the eclipse workspace etc.
I found a folder called runtime-EclipseApplication in a high level folder outside the directories where I keep my workspace and projects.
What is this folder, when/why is it created and is it safe to delete?
This is the default for the workspace name when you use Run As > Eclipse Application.
You can look in the Eclipse Applications section of the Run > Run Configurations dialog to see what (if anything) is using this workspace. The workspace name is shown in the Location field of the Main tab.

Solution for eclipse project portability?

In my work env, I have setup the eclipse project in my PC which includes some Workspace Environment Variables, setting Project dependency and setting User library (from a common network location).
Now my fellow colleague who has checked out the same source code goes through same steps.
Is there a way to reduce this clutter ?
From what I could see is that only the source project location is different from my PC and other PC.
Is there any that I could change my project locations during eclipse startup in the other PC ?
So I could easily retain the same settings on another PC with same workspace.
First steps:
Use a version control system to store and share your projects.
Check in everything that is contained in your workspace. That is not only your source code, but also the settings files in the hidden settings folder.
Do not use Window -> Preferences to modify Java settings (or other build related settings). Instead always use Project -> Properties to modify build related settings.
Never ever refer a network share or another location outside of your workspace. If you need a jar file which is currently on a network share, then check it into your version control system and afterwards check it out in your Eclipse workspace as local file.
Second step:
Use Maven for project materialization, dependency and other management.

How to remove launch configuration histories in eclipse?

Right click an arbitrary existing project in Package Explore, choose "export..." - "Java" - "Runnable JAR file", I find all the old projects in the "launch configuration" list. Those projects have already been removed from the disk, and are not visible in the Package Explore. How can I remove them from that list? I'm using eclipse indigo.
This question seems to be well answered here, however, to make changes I have simply deleted every undesirable launch configuration from the below path.
${WORKSPACE}/.metadata/.plugins/org.eclipse.debug.core/.launches/Delete all the .class LAUNCH Files
After deleting the files, it is necessary to restart Eclipse for the changes to take effect.
Under Window...Preferences...Run/Debug...Launching...Launch Configurations, you can activate and deactivate some filters that restrict what is shown in Run...Run Configurations. I think it is what you are looking for.
Eclipse menu -> Run -> Run Configurations... pops up the list of all viable run configurations, grouped by type. You are looking for those under Java Application. Any of these are deletable. Delete them and they will no longer show up in Run/Launch configuration lists.
Go to Run->Run configuration. Delete the existing saved projects under the Java Application.
Run the class, having main method from eclipse. It will be automatically set.
create runnable Jar.
Go to Run->Run configuration. Delete the existing saved projects under the Java Application.
Then run the class, having main method from eclipse. It will be automatically set.
Now create runnable Jar.

common workspace setup in eclipse

I want to create several workspaces which point to different branches of a codebase.
The problem I am facing is every time I need to create a new workspace I have to do the same configuration for each workspace.
Example:
Setting up tomcat configuration and it's related java options such as library and java agent settings.
A system variable that points to specific folder containg my jar files.
Another system variable
Questions:
is it possible to have these setups done once so that all subsequent workspaces do not need to be configured?
is it possible to export these preferences and import later into any workspace either on my machine or other machine?
System information:
Windows 7, Eclipse 3.5, Sysdeo tomcat plugin, Tomcat 6
While eclipse does have an Export preferences option, it does not export everything and specifically it is not comprehensive enough for workspace duplication.
In the past I have had a lot of success just cloning the physical workspace folder itself.
For example, let's say you have setup the workspace with everything that you want in it. To duplicate it, find out the path of the current workspace folder by going to File -> Switch workspace -> Other. The path shown here in the dialogue that pops up is the current workspace path ( don't press ok yet)
Create a copy of this folder. Now to use this copy, just use it in the above dialogue, i.e., go to File -> Switch workspace -> Other and put in the path of the copy. Press OK and Eclipse shall restart with the new workspace. Now the only thing you will have to do is point the code to a different branch. Rest all the settings should be present already.
This works specially well on the same machine. If you copy this workspace folder it should still work but your mileage may vary.

Where are projects stored in Eclipse?

The Project Explorer is able to list all projects in Eclipse. I am wondering where the project information gets stored?
The projects can be found under the .metadata directory of your workspace:
[eclipse-workspace]/.metadata/.plugins/org.eclipse.core.resources/.projects
Each project contains a .location file (in binary format) which presumably tells eclipse where the project is located on the filesystem, if it has been imported.
By default projects in Eclipse are stored under your workspace. You get asked where your workspace is created or which one to open whenever you open Eclipse, but you can configure it to not ask you again.
If you configured Eclipse not to ask again, then you can go to General -> Startup and Shutdown -> Workspaces in your preferences and check "Prompt for workspace on startup".
That page also lists your recently used workspaces (with probably just 1 entry, if you never explicitly specified a different one).
Note that you can also create projects that are located outside of your workspace, by explicitly specifying a separate location per-project.
Browse over to your workspace folder. You will see a folder for each project.
(Don't know where your workspace folder is? Try File -> Switch workspace... and it will give you the path.)
In Windows, usually C:\Users\%USERNAME%\workspace
Where %USERNAME% is the username given to your computer. eg. john
You can paste the above path in Run(Windows + R) window and it will pick the username automatically for you though.
For Eclipse Kepler SR2 on Windows 7
The easiest way to retrieve general info about a project (e.g., its location), see the following:
go to your "Package Explorer" view;
right-click on your project top-hierarchy folder;
choose "Show In" -> "Properties";
and you'll get the list of properties for that project in the "Properties view". Location of project will be in there.
On a Windows PC, you should be able to find your projects under C:\Users\yourname\workspace\. If you're on Linux, it should be under /home/yourname/workspace/.
I used the "Try File -> Switch workspace" suggestion which works but also re-installed Eclipse 0_0