views:

740

answers:

3

Hi there

I'm adding an eclipse project to our existing code-base, and I'd like to know if there is a way to exclude some directories from being picked up by eclipse at all? The reason is that we have a huge "third-party" directory in our repository that cannot be present in the project for the pair-programming plugin we are using to be able to sync efficiently.

Any clues?

+1  A: 

Yes, you may place a custom filter on your project. In your project explorer view, there should be a white, downwards pointing arrow near the top of the panel by the Package Explorer tab. Click it, and go to Filters. From there, you can specify certain folder patterns you do not want detected by checking the box next to Name Filter Patterns. In this case, I would put the name of the 3rd party library.

AlbertoPL
Alberto: thanks for the pointer, I didn't know about this at all. Only trouble is I cant find a way to exclude a whole folder at all. And as Rich points out, they will still be in the project, which will be an issue for us (I guess the plugin will try to sync them).
jkp
+2  A: 

Filters will hide resources from view, but they're still in the project. If you create a project in another location you can create linked resources to the folders you want to include in your project.

For reference I posted another answer that describes how to use linked resources in more detail.

Rich Seller
Rich: this was my initial approach, but the problem I found was that I couldnt make the resources relative to the project: the whole path was hard-coded. This was an issue because I need to commit the project to our SCM. Any ideas how to solve that?
jkp
I added a link to another answer that describes this in more detail. You can use a variable on the paths, if the projects are in the workspace, you can use WORKSPACE_ROOT
Rich Seller
Fantastic. I did know about the variables but I couldnt get them to work earlier. With this I should be good to go. Great answer: just what I was looking for.
jkp
A: 

The way I've always done it is to explicitly check out projects as peers. e.g:

~/myworkspace/goodproject
~/myworkspace/3rdparty

then import only "goodproject" into eclipse. If "3rdparty" is a subdirectory of goodproject, you can fake it out... Say for example your svn project looks like this:

project/
       src/
          main/
          3rdparty/

You can locally create project/src/ then checkout only the "main" directory, and have eclipse rely on a packaged version (e.g. point to the jar if your project is java).

Gabriel