Is there a way to exclude certain folders (and all their subfolders) from searching within Eclipse?
There is a straight way to do it: Right-click a project folder in Project Explorer tree and go to "Properties". Resource -> Resource Filters. Add as many exclusion filters for files/folders as you like.
Select the Privacy & security category from the left side. Scroll down and click on the Searching Windows tab. On the Searching Windows page, click on the Add an excluded folder button and select the folder that you want to hide from Windows Search. This will add the selected folder to the list of excluded folders.
The Eclipse search dialog box allows you to search for files that contain a literal or a character pattern in the entire workspace, a set of projects, a specific project or folders selects in the package explorer view. Clicking on the Search menu and selecting Search or File or Java. Clicking Ctrl + H.
The quick and dirty way:
Right click on a folder, go to properties, and mark a folder as derived. Derived entities are excluded from searching by default. The problem with this approach is that Eclipse "forgets" that the folder is derived if you delete it (either from within Eclipse or externally, followed by refreshing the project tree). Like so often with Eclipse, this is a long-standing bug (10 years in this case) which still applies to the current version (4.6 Neon at the time of writing).
The safe way:
Create a working set including only those entities you want searched and search only within that working set. See Dave Ray's answer for details on this procedure.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With