简体   繁体   English

我应该在使用Maven时将Eclipse设置和.project文件放到SCM中吗?

[英]Should I put Eclipse settings and .project file to SCM when using Maven?

Should I put .classpath , .project files and .settings files on SCM when working with Maven project with m2eclipse plugin? 在使用m2eclipse插件处理Maven项目时,我应该在SCM上放置.classpath.project文件和.settings文件吗? Theoretically every developer can grab the sources and import maven projects. 从理论上讲,每个开发人员都可以获取源并导入maven项目。

Due to your experience is it better to do this that way or to put Eclipse files to SCM too? 根据您的经验,以这种方式执行此操作还是将Eclipse文件也放入SCM更好? Some developers are using InteliJ so I don't want the projects to be Eclipse specific. 一些开发人员正在使用InteliJ,所以我不希望项目是特定于Eclipse的。 It seems that the .project file may change according to the set of installed plugins, eg change buildCommand from org.eclipse.jdt.core.javabuilder to org.eclipse.wst.common.project.facet.core.builder etc. 似乎.project文件可能会根据已安装的插件集进行更改,例如将buildCommandorg.eclipse.jdt.core.javabuilder更改为org.eclipse.wst.common.project.facet.core.builder等。

Please share your knowledge and experience. 请分享您的知识和经验。

In my experience, you should not include .classpath , .project or .settings . 根据我的经验,你应该包括.classpath.project.settings All the information needed to re-import the project is in the pom file, so long as you use "import existing maven projects". 只要您使用“导入现有的maven项目”,重新导入项目所需的所有信息都在pom文件中。

If you put all those local ones, you are likely to end up having SCM changes for irrelevant things, such as different order of entries, local modifications someone made to their project preferences, etc... 如果你把所有那些本地的东西放在一起,你可能最终会对不相关的东西进行SCM更改,例如不同的条目顺序,某人对他们的项目偏好进行的本地修改等等......

As per my experience , it is safe to check-in .project file as it defines the nature and other properties which is useful for developers who will be creating new workspace. 根据我的经验,签入.project文件是安全的,因为它定义了对创建新工作区的开发人员有用的性质和其他属性。 Many times, custom facets needs to be added via Eclipse and you may want to share it with other members of your team provided all others use the same IDE for example RAD. 很多时候,需要通过Eclipse添加自定义方面,如果所有其他成员使用相同的IDE(例如RAD),您可能希望与团队中的其他成员共享。 They won't have to go through the pain of again setting and changing project nature, so it might help. 他们不必经历再次设置和改变项目性质的痛苦,所以它可能会有所帮助。 Even we had to share our .settings folder in most cases because ppl were facing issues with workspace setup. 即使我们不得不在大多数情况下共享我们的.settings文件夹,因为ppl面临工作区设置问题。 So all depends on the need and it might help. 所有这些都取决于需求,它可能会有所帮助。

One situation in which it is very convenient to have Eclipse project files under version control is when you have Java code automatically generated by plugins. 将Eclipse项目文件置于版本控制之下非常方便的一种情况是,您可以通过插件自动生成Java代码。 Eclipse removes missing source directories from its configuration before code generators run. Eclipse在代码生成器运行之前从其配置中删除缺少的源目录。

UPDATE UPDATE

With recent Eclipse releases (I'd say since Juno, certainly since Mars) this is no longer the case. 最近的Eclipse发布(我自Juno以来就说过,自从火星发布以来),现在已不再是这样了。

Over the years the m2e plugin was greatly improved and nowadays there is really no need to store project settings in your SCM, as these settings are properly recreated from the project POM. 多年来m2e插件得到了极大的改进,现在确实没有必要在SCM中存储项目设置,因为这些设置可以从项目POM中正确地重新创建。 This has the added benefit of allowing the use of different Eclipse releases with the same project. 这具有允许在同一项目中使用不同Eclipse版本的额外好处。

暂无
暂无

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

相关问题 当项目团队使用INtelliJ或Eclipse时,我应该检入哪些设置文件 - Which settings files should I check in when the project team is using either of INtelliJ or Eclipse Eclipse Maven:没有“从 SCM 签出 Maven 项目”选项 - Eclipse Maven: no "Checkout Maven project from SCM" option Eclipse-Maven:不显示SCM的Maven项目 - Eclipse-Maven: Doesn't show Maven project from SCM 我应该将ical4j.properties文件放在Eclipse Android项目中的什么位置? - Where should I put the ical4j.properties file in an Eclipse Android project? m2eclipse:如何在导入maven项目时设置Eclipse项目设置? - m2eclipse: How to set Eclipse project settings when importing a maven project? 我如何在 Javascript 中编写脚本(最好)eclipse 命令:Import/Check out Maven Projects from SCM using eclipse easy - How could I script in Javascript (preferably) the eclipse command: Import/Check out Maven Projects from SCM using eclipse ease Eclipse动态Web项目:我应该在哪里放置资源文件 - Eclipse dynamic web project : where should I put resource files 当我尝试打开项目设置时,Eclipse for Android没有响应 - Eclipse for Android not responding when I try to open project settings 我应该将我的Websphere Liberty Profile项目添加到SCM吗? - Should I add my Websphere Liberty Profile project to SCM? 更新maven项目中的.settings / org.eclipse.wst.common.component文件 - Updating .settings/org.eclipse.wst.common.component file in a maven project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM