0

I've just ported a C++ system from codeblocks to eclipse. I now wish to put the workspace under source code control. I don't know if I have set this up correctly. The directory structure looks like

toplevel
+--.metadata
   +--very big file structure
+--project1
   +--.project
   +--.cproject
   +--various cpp/h files
+--project2
   +--.project
   +--.cproject
   +--various cpp/h files

What I would like is to be able to checkout everything on a different machine, start up eclipse, point it to the workspace and pick up all the projects. I know I have to keep the .project and .cproject files but what do I need to keep in .metadata or have I got the entire structure wrong?

Edit I found Where in an Eclipse workspace is the list of projects stored? which recommends .metadata/.plugins/org.eclipse.core.resources/.projects but there is a structure under each project folder containing .markers .indexes and properties.index. Do all these need to be kept? I had a bad experience with codeblocks where I kept the layout file and even though I finally deleted it, it was stuck in the source code control system forever.

Community
  • 1
  • 1
cup
  • 7,589
  • 4
  • 19
  • 42

1 Answers1

0

I would discourage you from putting .metadata folder into source code repository. It is a very complex and large folder that contains internal plug-in data. It is very hard to keep it in the repository.

The recommended way is to store only the project folders (project1 and project2) in the repo along with .project, .cproject and .settings. You can then import them using subversion or git on any other machine.

Michał Grzejszczak
  • 2,599
  • 1
  • 23
  • 28
  • I probably need to store something in *.metadata*. If I just store .project and .cproject, I can't load the workspace from eclipse on a different machine. I'm running experiments to figure out what will reload the workspace. – cup Dec 29 '16 at 12:36
  • You are better off just sharing _projects_ from workspace not entire workspace. This is how most people use Eclipse: create a fresh workspace on another machine and import your projects into it. – Michał Grzejszczak Dec 29 '16 at 16:06
  • This will work for small systems which have about 5 projects. The problem is there are about 25 projects: combination of libs, DLLs and executables. Development systems like Visual Studio and Codeblocks can keep all the projects in one solution. I'm just looking for the eclipse equivalent. – cup Dec 29 '16 at 21:38
  • Did a few experiments but couldn't figure out which files in .metadata reproduced the workspace. I just saved the .project and .cproject files then imported from the top level directory and it picked up all the projects which is basically what I wanted but in 2 steps instead of 1. – cup Dec 31 '16 at 21:20