[英]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. 我花了很多时间修改我的Java代码样式设置是我喜欢的方式。
For example, go to Windows -> Preferences -> Java -> Code Style -> Clean Up / Formatter / Code Templates
. 例如,转到
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. 我设置eclipse使用空格而不是tab chars,自定义java文件顶部的标题,以及一大堆其他东西。
Now I'm working on a different computer and had to install a new copy of Eclipse Helios. 现在我正在使用另一台计算机,并且必须安装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. 如果您有“项目特定设置”,则它位于项目的“
.settings
”目录中。
<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. Windows - > Preferences - > Java - > Code Style
下的每个选项Windows - > Preferences - > Java - > Code Style
都可以选择将当前设置export
到XML文件。 You can then import
that XML file into the other Eclipse install. 然后,您可以
import
该XML文件到其他Eclipse安装。
And store it in your SCM. 并将其存储在您的SCM中。
Dont waste time trying to find the file in eclipse's settings area. 不要浪费时间在eclipse的设置区域中找到文件。 Instead click the "edit" button on your settings profile and export it to a file of your choosing.
而是单击设置配置文件中的“编辑”按钮并将其导出到您选择的文件中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.