简体   繁体   English

Eclipse:如何在整个团队中共享Java编译器错误/警告设置

[英]Eclipse: How to share Java compiler errors/warnings settings across entire team

We are in the process of standardizing our default Eclipse configuration (styles, settings, dictionary, formatting, run configurations, etc.) for our developers. 我们正在为我们的开发人员标准化我们的默认Eclipse配置(样式,设置,字典,格式,运行配置等)。

However, for Java compiler errors and warnings preferences, there does not seem to be any way to export/import settings. 但是,对于Java编译器错误和警告首选项,似乎没有任何方法可以导出/导入设置。 Is there another way to do this? 还有另一种方法吗?

Eclipse allow you to export your preferences via Eclipse允许您通过导出首选项

File > Export > Preferences 文件>导出>首选项

You will see a list of exportable preferences, which contains Java Compiler Preference , you can even choose specified preference to export. 您将看到包含Java Compiler Preference的可导出首选项列表,您甚至可以选择要导出的指定首选项。

After that, you can import the preferences into a new workspace via 之后,您可以将首选项导入新工作区

File > Import > Preferences 文件>导入>首选项

The ideal way to share settings within the team (for use within the IDE) is to use project specific settings . 在团队中共享设置(在IDE中使用)的理想方法是使用项目特定设置 The project specific settings become part of the project and go into source control repository, hence every team member gets them for free. 项目特定设置成为项目的一部分并进入源控制存储库,因此每个团队成员都可以免费获取它们。

Most of the settings you mention in the question can be configured per project. 您可以根据项目配置问题中提到的大多数设置。

I've developed a maven plugin (called codecleaner) that spread pre-configured eclipse settings for maven projects. 我开发了一个maven插件(称为codecleaner),它为maven项目传播预先配置的eclipse设置。 It is very usefull wehn you dont want to put eclipse settings under version control, or when you want to save the time for manulay add the settings for each of the projects 如果您不希望将eclipse设置置于版本控制之下,或者您希望节省时间以便为每个项目添加设置,那么它非常有用

https://github.com/yonatanm/codecleaner https://github.com/yonatanm/codecleaner

currently The codecleaner plugin update the following types of eclipse settings: 目前,codecleaner插件更新了以下类型的eclipse设置:

  • Code Formatter 代码格式化程序
  • Save Actions 保存操作
  • Clean up settings 清理设置
  • Compiler Error/Warning level 编译器错误/警告级别
  • JSP/XML/XSD/HTML Validation JSP / XML / XSD / HTML验证

In our team we use workspace mechanic to share the same workspace preferences by putting the preferences files on a shared drive. 在我们的团队中,我们使用工作区机制通过将首选项文件放在共享驱动器上来共享相同的工作区首选项。 A small introduction can be read here . 这里可以阅读一个小介绍。

Create a common build file (using Ant/Maven). 创建一个公共构建文件(使用Ant / Maven)。 If you use Maven, you can even ensure that the same jars are used by everyone while compiling. 如果您使用Maven,您甚至可以确保每个人在编译时都使用相同的罐子。

This can be fixed outside of Eclipse, starting with standardizing the build process as Amit mentioned. 这可以在Eclipse之外修复,从Amit提到的标准化构建过程开始。

You might also want to consider a continuous integration system which builds every time someone commits code. 您可能还需要考虑一个持续集成系统 ,该系统在每次有人提交代码时构建。 This keeps everybody on their toes, preventing people from pushing broken code. 这让每个人都保持警惕,防止人们破坏代码。 Any compiler errors/warnings are visible to everyone. 每个人都可以看到任何编译器错误/警告。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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