维护一组通用的 Eclipse 首选项

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/951509/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 13:45:15  来源:igfitidea点击:

Maintaining a common set of Eclipse preferences

eclipsesettingspreferences

提问by Robert Munteanu

Whenever I switch workspaces/Eclipse installs I need to copy/redo the preferences:

每当我切换工作区/Eclipse 安装时,我都需要复制/重做首选项:

  • compiler settings;
  • font sizes/families;
  • code formatter;
  • java code templates;
  • editor templates;
  • code clean-ups;
  • 编译器设置;
  • 字体大小/系列;
  • 代码格式化程序;
  • java代码模板;
  • 编辑器模板;
  • 代码清理;

I would like to maintain these settings in an unitary way, preferrably under source control. How can I do that?

我想以统一的方式维护这些设置,最好是在源代码控制下。我怎样才能做到这一点?



I know about 'copy settings' when creating a new workspace, but it does not keep updated copies.

我在创建新工作区时知道“复制设置”,但它不会保留更新的副本。

采纳答案by VonC

You could of course export/importthose settings.

您当然可以导出/导入这些设置。

The other approach is to enable project specific settings for some settings.

另一种方法是为某些设置启用项目特定设置。

http://www.peterfriese.de/wp-content/downloads/images/formatter_project_specific_settings.jpg

http://www.peterfriese.de/wp-content/downloads/images/formatter_project_specific_settings.jpg

We have a very small Git repository with those kind of files:

我们有一个非常小的 Git 存储库,其中包含这些文件:

http://www.mkyong.com/wp-content/uploads/2009/01/wicket-examples-7.jpg

http://www.mkyong.com/wp-content/uploads/2009/01/wicket-examples-7.jpg

  • .settings/org.eclipse.jdt.core.prefs(compiler problem settings and formatter rules)
  • .settings/org.eclipse.jdt.ui.pref(cleanup rules, common code templates)
  • .settings/org.eclipse.jdt.core.prefs(编译器问题设置和格式化规则)
  • .settings/org.eclipse.jdt.ui.pref(清理规则,常用代码模板)

The common settings are just copied/merged in each projects .settingsdirectory, ensuring common rules amongst all projects, whatever the workspace.

通用设置只是在每个项目.settings目录中复制/合并,确保所有项目之间的通用规则,无论工作区如何。

回答by walderik

You could also try Workspace Mechanic. It works perfect for this. http://code.google.com/a/eclipselabs.org/p/workspacemechanic/

您也可以尝试 Workspace Mechanic。它非常适合这个。 http://code.google.com/a/eclipselabs.org/p/workspacemechanic/

回答by VonC

You now have a good example of a separate project maintaining Eclipse preferences, as plugin.

您现在有一个很好的示例,它是一个单独的项目,用于维护 Eclipse 首选项,作为plugin

See the saneclipseproject from Lars Vogel.

请参阅Lars Vogelsaneclipse项目。

You also have the associated vogellacompany/com.vogella.saneclipserepo, which will tweak and fine-tune the settings of:

您还有相关的存储vogellacompany/com.vogella.saneclipse库,它将调整和微调以下设置:

com.vogella.saneclipse.preferences/.settings/org.eclipse.jdt.core.prefs
com.vogella.saneclipse.preferences/.settings/org.eclipse.core.runtime.prefs
com.vogella.saneclipse.preferences/.settings/org.eclipse.core.resources.prefs
com.vogella.saneclipse.templates/.settings/org.eclipse.jdt.core.prefs
com.vogella.saneclipse.fileextensions/.settings/org.eclipse.jdt.core.prefs
com.vogella.saneclipse.fileextensions/.settings/org.eclipse.pde.core.prefs

回答by Miles

Eclipse now ships with a tool called Oomph Setup. This tool can be used to record the preference changes that happen in your workspace, synchronize those preferences across multiple machines using an online service, and apply the preferences to both new and existing workspaces.

Eclipse 现在附带了一个名为Oomph Setup的工具。此工具可用于记录工作区中发生的首选项更改,使用在线服务在多台计算机之间同步这些首选项,并将首选项应用于新的和现有的工作区。

"Oomph" is actually a broader set of tools and low-level frameworks that are used throughout the Eclipse installation process, and it provides for very powerful automation possibilities, so the documentation is sometimes hard to follow for an end user who's just interested in simple preference synchronization. Here are a collection of links about Oomph Setup that I found helpful:

“Oomph”实际上是在整个 Eclipse 安装过程中使用的一组更广泛的工具和低级框架,它提供了非常强大的自动化可能性,因此对于只对简单感兴趣的最终用户来说,有时难以理解文档偏好同步。以下是我发现有帮助的有关 Oomph 设置的链接集合:

回答by zvikico

Check out Pulse Freelance Edition. It has the ability to sync workspaces (commercial).

查看Pulse 自由职业者版。它能够同步工作区(商业)。