- This topic has 7 replies, 3 voices, and was last updated 16 years, 3 months ago by Brian Fernandes.
-
AuthorPosts
-
Walter StovallMemberI’m having trouble distributing a workspace to others in my company. We store the workspace under version control, including the .metadata folder. I updated our code-style/formatting rules and with a multi-file diff it looks like the meaningful changes to .metadata items includes only .metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.jdt.ui.prefs. But when I update this file in version control and get the whole workspace afresh and try to apply the formatting rules with ctrl-shift-F the output doesn’t look right. Then I go to Window->Preferences->Java->Code Style->Formatter-> and the Preview window looks consistent with the rules I want. I press [Edit…] and then OK and dismiss. Then try to format my source and it works right. So eclipse seems to ‘get in sync’ with what’s in my org.eclipse.jdt.ui.prefs file by just viewing the rules and pressing OK. If I don’t press Edit/OK then the wrong rules are applied. My rules are in a profile called ByersConventions and that shows as the Active Profile when I enter the formatting dialog.
How can I resolve this problem? Is there a better way for me to distribute workspaces? I don’t lock/put every file that changes in .metadata because tons of files are just history, indexes, etc. and our version control system would grow and grow if I did that. My company is on PVCS for version control as a corporate standard for 25 years and I can’t change that to something that fits the world of Java better.
Thanks for your help.
Loyal WaterMemberYou can go to File > Export > General > Preferences and export your preferences.
Now, this .epf file can be imported into the new workspace by going to File > Import > General > Preferences.
You can distribute this .epf file.
Walter StovallMemberThanks for that response but that doesn’t address my fundamental problem. Exporting the formatting rules makes it possible to update a workspace on one computer with formatting rules developed on another computer. But my problem is that I want to update our version control system which stores the workspace.
Our version control has every file in the .metadata and other workspace folders stored as a pvcs archive. When a user extracts the workspace from pvcs, it should come down with appropriate formatting rules. I found that the rules are apparently stored in org.eclipse.jdt.ui.prefs but I also find that updating that file in version control is apparently not quite enough to have the rules be used at runtime. As I outline in my previous post the user has to visit the GUI that edits the rules and press OK. I’d like to eliminate that problem if I can but I don’t know why that happens?
Loyal WaterMemberI’m afraid yopu cannot checkout a workspace along with the formatting rules. You will have to set formatting rules for the workspace once the project has been checked out into the workspace.
Walter StovallMemberI don’t think I’m being clear on my problem. How do I go about maintaining a workspace in a version control system? i.e. how do I know which files should be checked into the version control system?
One approach is to take every single file in the .metadata folder and make it part of the version control system so when you extract it from version control you simply get all of those files back as they were originally stored by eclipse.
But this is not a practical way to maintain the workspace. When you change eclipse settings for the workspace (or even when you don’t) you’ll find that many files in the .metadata folder change but don’t have important differences. For example, sometimes the cache of the whole file tree is saved under a new name. If you check in every physical file difference every time you change a setting in eclipse you’ll quickly have many many unnecessary revisions and archives under version control.
So I take an approach were I scan the file tree for differences that I’ve learned thru trial and error are ‘signficiant’ or relevant to the change I want to expose to version control.
Is there a better way?
Loyal WaterMemberYou need to do a workspace restart between checking out the workspace from CVS and formatting, those preferences are read on startup.
Walter StovallMemberExcuse the late response – back from vacation…
The need for a restart is not my problem – you do mean restart Eclipse correct? I clean all workspace/project files from my hard disk, extract all files from version control, then start Eclipse. But I still need to visit Window->Preferences->Java->Code Style->Formatter->[Edit…]->OK in order for my formatting rules to be used.
Your 8/21 response seems to indicate that I can’t store formatting rules in version control because you say I must set them after checking out the project. Then in response to my question about which files need to be stored in version control, the response is that I need to restart?
Please let me broaden the topic here. Which files need to be stored in version control in order to properly keep the entire workspace under version control? If I knew that I wouldn’t have to understand how the formatting rules specifically are stored in the .metadata folder.
Thanks – Walter
Brian FernandesModeratorWalter,
The folder you identified earlier: .metadata\.plugins\org.eclipse.core.runtime\.settings\ is where all the workspace preferences are stored, so you may want to commit all that to version control.
Unfortunately, Eclipse really isn’t built to work like this. From your experience with the JDT formatting page, it is obvious that you have saved the right file, but Eclipse doesn’t know you have modified it (when you check it out). The standard way remains a manual import of the preferences, after which eclipse will be notified and react accordingly.
I would suggest trying to start eclipse with the -clean argument to see if that forces eclipse to pick up the new preferences. Other than that I do not have any other suggestions.
Finally, if you want a better way to share a workspace with your team, I recommend using our sister product, Pulse. The MyEclipse team uses Pulse internally to make sure our development workspaces are in synch with each other. Pulse will tell you if additional projects have been added to your shared profile and allow you to update / save workspace preferences to your profile easily. More information here: http://www.poweredbypulse.com/products_freelance_win.php
Hope this helps.
-
AuthorPosts