哪些Eclipse文件属于版本控制? [英] Which Eclipse files belong under version control?

查看:146
本文介绍了哪些Eclipse文件属于版本控制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

除了源代码之外,哪些Eclipse文件是适当的源代码控制?

Which Eclipse files is it appropriate to put under source control, aside from the sources obviously?

在我的项目中,具体来说,我在想: p>

In my project, specifically, I'm wondering about:


.metadata / *

project-dir / .project

project-dir / .classpath

project-dir / .settings / *

.metadata/*
project-dir/.project
project-dir/.classpath
project-dir/.settings/*

如果有任何这些依赖,请解释您的指导。

If there are any of these for which it depends, please explain your guidelines.

推荐答案

元数据不应在源代码管理中进行管理。它们主要包含与您的工作区相关的数据。

Metadata should not be managed in source control. They contain mostly data relevant to your workspace.

唯一的例外是 .launch XML文件(启动器定义)。

The only exception is the .launch XML files (launcher definition).

它们位于

[eclipse-workspace]\.metadata\.plugins\org.eclipse.debug.core\.launches

它们应该被复制到您的项目目录中:当您的项目被刷新时,这些配置将显示在运行配置对话框中。

And they should be copied into your project directory: When your project is refreshed, those configurations will be displayed in the "Run configuration" dialog.

这样,这些启动参数文件也可以管理到SCM中。

That way, those launch parameter files can be also managed into the SCM.

(警告:Do 取消选中删除关联资源时删除配置 / strong>在运行 / 启动 / 启动配置首选项面板:通常软删除项目以便将其导入再次强制重新初始化eclipse元数据,但是如果选中该选项,将会删除您的详细启动ch参数!)

(Warning: Do uncheck the option "Delete configurations when associated resource is deleted" in the Run/Launching/Launch Configuration preference panel: It is common to soft-delete a project in order to import it back again - to force a reinitialization of the eclipse metadata. But this option, if checked, will remove your detailed launch parameters!)

project-dir/.project
project-dir/.classpath
project-dir/.settings/* 

应该在您的SCM(特别是 .project .classpath 根据 Eclipse文档)。

should be in your SCM (especially .project and .classpath according to the Eclipse documentation).

目标是任何人都可以检出/更新他/她的SCM工作区,并将Eclipse项目导入Eclipse

为此,您只想在.classpath中使用相对路径,使用 链接资源

For that, you want to use only relative paths in your .classpath, using linked resources.

注意:如果 project-dir 是指外部项目目录,而不是在eclipse工作区下创建的目录。这样,两个概念(eclipse工作空间与SCM工作空间)明显分开。

Note: it is better if project-dir refers to an "external" project directory, not a directory created under the eclipse workspace. That way, the two notions (eclipse workspace vs. SCM workspace) are clearly separated.

As ipsquiggle 在评论中提到,正如我已经提到中,您可以将启动配置保存为共享文件直接保存在您的项目目录。所有启动配置可以像其他项目文件一样进行版本控制。

As ipsquiggle mentions in the comment, and as I have alluded to in an old answer, you can actually save the launching configuration as shared file directly in your project directory. All launching configuration can then be versioned like the other project files.

(从博客文章提示:创建和共享启动配置(来自KD)

(From the blog post Tip: Creating and Sharing Launch Configurations from KD)

这篇关于哪些Eclipse文件属于版本控制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆