简体   繁体   中英

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

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?

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.

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.

Dont waste time trying to find the file in eclipse's settings area. Instead click the "edit" button on your settings profile and export it to a file of your choosing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM