Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add a second source directory to an Eclipse project

Tags:

c

eclipse

I have a C project in Eclipse that stores its files in two directories at the same level along with a bunch of other stuff that I do not need to have in the project.

/path/
     /code_I_want
     /bad_stuff/
     /more_code_i_want/
     /huge_pile_of_other_code/

Edit: The source directory is a Clearcase VOB mount point so I can't control what ends up there.

like image 332
Arthur Ulfeldt Avatar asked Dec 15 '09 01:12

Arthur Ulfeldt


2 Answers

  1. Create a new C project in Eclipse. You can give it its own directory at some arbitrary location in the filesystem, or you can point its folder at code_I_want or more_code_i_want.
  2. Go under File, New, Folder. Click the Advanced section and click "Link to folder in the file system." This creates a virtual folder within your Eclipse project (similar to a symlink, if you're familiar with Linux / Unix) to whatever path you specify. Use this to make code_I_want and/or more_code_i_want into virtual subdirectories of your Eclipse project.
  3. Notice the Variables button there under the Advanced section? That can be used to help create relative paths. (For example, each of our developers sets a per-user variable called APP to point to their local working copy, then the Eclipse project settings can be shared between developers regardless of where they keep their working copies.) To define variables, go under Windows, Preferences, General, Workspace, Linked Resources.

Edit: Or you can just create symlinks.

like image 178
Josh Kelley Avatar answered Sep 30 '22 18:09

Josh Kelley


Try this:

Project > Properties > Java Build Path > Source > Add Folder

like image 22
jdigital Avatar answered Sep 30 '22 17:09

jdigital