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
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.
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.
If you want to add filters directly inside .project file, these are some rules:
<type>6</type> <!-- exclude all, files -->
<type>5</type> <!-- include only, files -->
<type>13</type> <!-- include only, files and folders -->
<type>26</type><!-- exclude all, folders, all children -->
<arguments>1.0-name-matches-false-false-xyz</arguments> <!-- case sensitive=false, regular expression=false, something named=xyz -->
<arguments>1.0-name-matches-true-false-EEE</arguments> <!-- case sensitive = true, regular expression = false, something named=EEE -->
<arguments>1.0-name-matches-false-false-www</arguments> <!--case sensitive=false, regular expression = false, something named=www -->
One .project filter section for example:
<filteredResources>
<filter>
<id>1567020347706</id>
<name></name>
<type>6</type> <!-- exclude all, files -->
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-abc</arguments>
</matcher>
</filter>
<filter>
<id>1567020347708</id>
<name></name>
<type>5</type> <!-- include only, files -->
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-xyz</arguments> <!-- case sensitive=false, regular expression=false -->
</matcher>
</filter>
<filter>
<id>1567020347711</id>
<name></name>
<type>13</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-mno</arguments>
</matcher>
</filter>
<filter>
<id>1567020347713</id>
<name></name>
<type>26</type><!-- exclude all, folders, all children -->
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-true-false-EEE</arguments> <!-- case sensitive = true, regular expression = false -->
</matcher>
</filter>
<filter>
<id>1567020347716</id>
<name></name>
<type>26</type> <!-- exclude all, folders, all children -->
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-www</arguments> <!-- case sensitive = false, regular expression = false -->
</matcher>
</filter>
</filteredResources>
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).
There is a straight way to do it:
P.S. If your project tree is not updated automatically you may have to press F5 while having input focus in Project Explorer window.