Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
220 views
in Technique[技术] by (71.8m points)

Which Eclipse files belong under version control?

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

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

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

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

Question&Answers:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

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

They are found in

[eclipse-workspace].metadata.pluginsorg.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.

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

(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/* 

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

The goal is that anyone can checkout/update his/her SCM workspace and import the Eclipse project into the Eclipse workspace.

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

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 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.

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

alt text


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...