Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit » what eclipse files to add to repo?
what eclipse files to add to repo? [message #877127] Fri, 25 May 2012 23:19 Go to next message
ian scott-fleming is currently offline ian scott-fleming
Messages: 2
Registered: May 2012
Junior Member
Noob here...

What Eclipse project files/folders should be added to preserve the project information so the project can be imported?

In tutorial at www.vogella.com/articles/EGit/article.html , author seems to suggest:
.project
.buildpath
.gitignore

Am currently doing C/C++ (CDT), R (StatET), Python (PyDev) & shell scripting (ShellEd) with eclipse.

I also see
.cproject (in my c/c++ projects)
.pydevproject (in my python projects)

Q1: Is it appropriate to add all these to the repos in order to retain all relevant Eclipse Project information when cloning the repo to a different machine?

Q2: Will including these files cause problems when cloning the repo to Eclipse in a different environment (i.e., move project from Mac OS X to linux box), assuming the code is not OS-specific (no GUI stuff)?

Thanks.
Re: what eclipse files to add to repo? [message #877306 is a reply to message #877127] Sat, 26 May 2012 11:47 Go to previous messageGo to next message
R Shapiro is currently offline R Shapiro
Messages: 386
Registered: June 2011
Senior Member
To share project structure in a reasonable way you need the Eclipse meta-data files. For Java/Android, C++ and Python that would include at least .project, .buildpath, .cproject, .pydevdevproject, and .springBeans (if you're using Spring). Also files in the .externalToolBuilders directory, if you have any of those. I'm sure there are others I haven't run into yet.

Almost always it's also a good idea to share files in project .settings directories (you can handle user-specific settings in the workspace preferences). Similarly .launch files for Eclipse launchers.

It's always a good idea to share .gitignore in my opinion, whether or not you're working in Eclipse. You don't need these to import a project but it makes it far less likely that someone will accidentally add other files that shouldn't be under version control.

None of these are site- or platform-specific as far as I know. In general the site- and platform-specific aspects of Eclipse are handled at the workspace level, not the .project level. Similarly things like user libraries, classpath variables, string substitutions etc -- those are all workspace settings, not project settings. Workspace contents should never be under version control. This is yet another reason to keep workspace directories completely separate from project directories.

Re: what eclipse files to add to repo? [message #877803 is a reply to message #877306] Sun, 27 May 2012 19:54 Go to previous messageGo to next message
ian scott-fleming is currently offline ian scott-fleming
Messages: 2
Registered: May 2012
Junior Member
Thanks. This raises another question, on an issue I haven't had to deal with yet in moving projects from one system to another (with or without git or egit). What is the appropriate way to deal with paths to project dependencies, when the dependencies might be in different locations on different machines?

Given a C/C++ project that links with library X, the settings for this must be project-specific, so I would expect it to be somewhere in the project directory tree. In a non-eclipse project, these would be in the makefile. Where are the settings for this kept in Eclipse?

Seems like there's the potential for a conflict here...machine A has library X in folder a, machine B has library X in folder b. If the path to library X is stored in the repo in the project settings, then pushes and pulls would step on the other machine's settings.

Is there any sort of Best-Practices for dealing with this?
Re: what eclipse files to add to repo? [message #877859 is a reply to message #877803] Sun, 27 May 2012 23:48 Go to previous message
R Shapiro is currently offline R Shapiro
Messages: 386
Registered: June 2011
Senior Member
External library dependencies are generally handled as workspace preferences both in CDT and Java (you could also use Maven in Java, though personally I detest Maven).

In Java you would generally do it either with a User Library or a Classpath Variable. The project references the lib/var by name while the actual file system value must be set by each developer as a workspace preference.

It's similar in CDT but I don't have an Eclipse C++ project handy right now to remember the precise details. The project can reference a variable like, say, BOOST_ROOT, which points at the Boost installation. Each developer is then responsible for assigning the right local value for that variable as a workspace preference.

Project dependencies are different. Each developer simply imports all the relevant projects into the workspace. Doesn't matter where they live in the file system -- all Eclipse knows, or needs to know, is that a project with a given name is part of the workspace.

Previous Topic:jgit git-new-workdir?
Next Topic:egit decorators and maven-eclipse
Goto Forum:
  


Current Time: Thu Oct 23 00:43:49 GMT 2014

Powered by FUDForum. Page generated in 0.06825 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software