Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What file(s) does eclipse store Java code style settings to?

Tags:

java

eclipse

I spent quite a bit of time modifying my Java code style settings to be the way I like.

For example, go to Windows -> Preferences -> Java -> Code Style -> Clean Up / Formatter / Code Templates.
I've set eclipse to use white space instead of tab chars, customized the heading on the top of java files, and a whole bunch of other stuff.

Now I'm working on a different computer and had to install a new copy of Eclipse Helios.
Is there a file or set of files I can reuse so I don't have to keep setting this up everytime?

like image 927
Frank Flannigan Avatar asked Sep 24 '10 19:09

Frank Flannigan


2 Answers

If you haven't set "project specific settings", it is in

workspace\.metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.jdt.ui.prefs

If you have "project specific settings", it is in the ".settings" directory of your project.

<profile kind\="CleanUpProfile" name\="t1" version\="2">
  <setting id\="cleanup.remove_unused_private_fields" value\="true"/>
  <setting id\="cleanup.always_use_parentheses_in_expressions" value\="false"/>
  ...

That latter option (project specific settings) makes it easier for you to version it in your source control tool, as part of the other project files you would want to get back when doing a checkout of a new version of your project somewhere else.

See "Do you keep your project files under version control?" for more.

like image 79
VonC Avatar answered Oct 18 '22 23:10

VonC


Every single one of the options under Windows - > Preferences - > Java - > Code Style has the option to export the current setting to an XML file. You can then import that XML file into the other Eclipse install.

And store it in your SCM.

like image 20
Instantsoup Avatar answered Oct 19 '22 00:10

Instantsoup