我应该将 Eclipse 设置 (.settings) 签入到 SVN 吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12513114/
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 19:00:51  来源:igfitidea点击:

Should I check-in the eclipse settings (.settings) to SVN?

javaeclipsesvnmavensettings

提问by Kayser

Possible Duplicate:
Which eclipse files belong under Version Control

可能的重复:
哪些 eclipse 文件属于版本控制

We use Eclipse IDE for developing. There is always a change in .settings folder. Sometimes we are configuring something in Eclipse, but usually we change anything in Eclipse.

我们使用 Eclipse IDE 进行开发。.settings 文件夹中总是有变化。有时我们在 Eclipse 中配置一些东西,但通常我们在 Eclipse 中更改任何东西。

Eclipse changes the settings without any request of us??

Eclipse 会在没有我们要求的情况下更改设置??

What is the best practise with .settings?

.settings 的最佳实践是什么?

Should I check in the eclipse settings (.settings) in SVN or add to ignore list?

我应该检查 SVN 中的 eclipse 设置 (.settings) 还是添加到忽略列表?

回答by Marko Topolnik

The .settingsdirectory contains – or at least should contain – vital information needed to successfully build your project inside Eclipse, such as the character encoding used for source code, Java compiler settings, and much more. If you don't commit that directory to the SCM, you will in most cases lose the ability to check out the project into a fresh workspace and immediately get it to compile. An especially sensitive aspect is the precise configuration of compiler errors/warnings. If a developer has these set up wrong, the consequences can range from frustrations by failed Eclipse builds to developers damaging code in an attempt to "fix" nonexistent errors/warnings.

.settings目录包含——或者至少应该包含——在 Eclipse 中成功构建项目所需的重要信息,例如用于源代码的字符编码、Java 编译器设置等等。如果您不将该目录提交给 SCM,在大多数情况下,您将无法将项目检出到新的工作区并立即进行编译。一个特别敏感的方面是编译器错误/警告的精确配置。如果开发人员的这些设置有误,后果可能包括因 Eclipse 构建失败而感到沮丧,以及开发人员破坏代码以试图“修复”不存在的错误/警告。

Each plugin can contribute its own settings file to the directory, so feel free to pick out and ignore the irrelevant ones, retaining the important ones, like org.eclipse.jdt.core.prefs.

每个插件都可以将自己的设置文件添加到目录中,因此可以随意挑选并忽略不相关的,保留重要的,例如org.eclipse.jdt.core.prefs.

You do have to be very careful not to mess with project-specific settings in a way that would break the build for others. Any personal preferences should be changed globally at the workspace level, so that this configuration doesn't propagate to teammates.

您必须非常小心,不要以一种会破坏其他人的构建的方式弄乱特定于项目的设置。任何个人首选项都应在工作区级别全局更改,以便此配置不会传播给团队成员。

One may theoretically enforce a policy where everyone is required to import project-specific settings from another place and never commit them, but that route offers no advantages and is obviously inferior in the ease-of-use department.

理论上可能会强制执行一项政策,要求每个人都从另一个地方导入项目特定的设置,并且从不提交,但该路线没有任何优势,并且在易用性方面显然不如。

回答by maba

Since you are using mavento manage your builds it really isn't necessary to put the .settingsunder source control.

由于您使用maven来管理您的构建,因此实际上没有必要将其.settings置于源代码控制之下。

By using maven you allow other IDE's to be used without being dependent on the eclipse settings.

通过使用 maven,您可以在不依赖于 eclipse 设置的情况下使用其他 IDE。

See also Should Eclipse-specific files in an VCS be ignored, if using Maven?

另请参阅如果使用 Maven,是否应忽略 VCS 中特定于 Eclipse 的文件?

回答by torbinsky

As you are using Maven I would definitely say no. From my experience with the projects I've worked on, committing these files causes problems, especially if you are collaborating with people who have different environments (OSX/Windows/*nix, file system layout).

当您使用 Maven 时,我肯定会说不。根据我参与的项目的经验,提交这些文件会导致问题,尤其是当您与具有不同环境(OSX/Windows/*nix,文件系统布局)的人合作时。

If you're not already using it, I would reccomend using the Maven Eclipse plugin (http://maven.apache.org/plugins/maven-eclipse-plugin/) to generate your Eclipse project files automatically.

如果您还没有使用它,我建议您使用 Maven Eclipse 插件 (http://maven.apache.org/plugins/maven-eclipse-plugin/) 来自动生成您的 Eclipse 项目文件。

Edit:

编辑:

Forgot to mention that probably the biggest reason I don't like to commit any Eclipse project settings/files is because of the clutter it adds to my VCS history. I have found that these files often change for apparently no reason (i.e. preference file timestamp changes) and at best add extra changes or at worst cause annoying conflicts.

忘了提到我不喜欢提交任何 Eclipse 项目设置/文件的最大原因可能是因为它给我的 VCS 历史增加了混乱。我发现这些文件经常无缘无故地更改(即首选项文件时间戳更改),充其量添加额外的更改,或者在最坏的情况下导致烦人的冲突。

回答by user1437891

It really depends on your project. This thread here should give you more than enough information to figure out what you need.

这真的取决于你的项目。这里的这个线程应该给你足够的信息来弄清楚你需要什么。

Which Eclipse files belong under version control?

哪些 Eclipse 文件属于版本控制?

回答by girish

No need,

不需要,

because different users suing different settings and config.

因为不同的用户起诉不同的设置和配置。

The setting can be described in text files

该设置可以在文本文件中描述

回答by Amit Deshpande

You can create best configuration and put it in SVN but this creates hell of trouble.

您可以创建最佳配置并将其放入 SVN 中,但这会带来麻烦。

  1. There is no guarantee that someone will commit wrong settings and everyone will suffer
  2. Settings will need to be changed every time configuration changes happen.
  1. 不能保证有人会犯错误的设置,每个人都会受苦
  2. 每次发生配置更改时,都需要更改设置。

It is better to put as reference if some one doesn't have any thing then he can start from it.

如果有人没有任何东西,最好作为参考,然后他可以从它开始。

回答by Oh Chin Boon

The straight answer is no. Not because this file eventually changes or not but project source code repository isn't for personal file settings.

直接的答案是否定的。不是因为此文件最终会更改与否,而是项目源代码存储库不适用于个人文件设置。

If you really need to put somewhere these IDE specific files, check-in to a separate SVN folder separate from the project.

如果您确实需要将这些 IDE 特定文件放在某处,请检入与项目分开的单独 SVN 文件夹。