简体   繁体   English

eclipse存储Java代码样式设置的文件是什么?

[英]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.

相关问题 如何在开发人员之间共享Eclipse Java / XML代码样式设置? - How to share eclipse Java/XML code style settings between developers? 在Eclipse中,哪个插件/类提供Java代码上的样式格式? - In Eclipse, what plugin/class provides the style formatting on Java code? 如何从Java文件导入代码样式到Eclipse? - How to import code style from java file to eclipse? Eclipse Java代码样式格式化程序 - Eclipse Java code style formatter 我的Java GUI代码有什么问题,Eclipse没有响应? - What's wrong with my java GUI code, Eclipse have no response? 从intellij-idea导入代码样式格式设置到eclipse - Importing code style formatting settings into eclipse from intellij-idea 什么是通过给定的wsdl文件自动生成Java客户端代码的正确工具/方式(文档文字包装样式) - what's the right tool/way to auto generate java client code by a given wsdl file (document literal wrapped style) eclipse在哪里存储Navigator View配置的设置? - Where does eclipse store the settings for Navigator View configuration? eclipse在哪里存储“外部字符串”对话框的设置? - Where does eclipse store the settings of the *Externalize Strings* dialog? Eclipse/Java 在哪里存储项目合规性? - Where does Eclipse/Java store project compliance?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM