68

I was wondering if it's possible to exclude target folder from eclipse quick search :

Ctrl+Shift+R

If anyone knows how to do that, please advise.

Update: I am using Maven 2, and M2E , WTP Eclipse plug-ins.

Lii
  • 11,553
  • 8
  • 64
  • 88
Mahmoud Saleh
  • 33,303
  • 119
  • 337
  • 498
  • Are you working in the context of Maven 2/3? Are you using any additional plugins? Do you have an example where a resource is in a target and non-target folder? – mliebelt Nov 21 '11 at 14:25
  • 1
    Related: [Exclude folders from Eclipse search](http://stackoverflow.com/questions/443169/eclipse-exclude-folders-from-search) – blahdiblah Sep 27 '12 at 21:36

3 Answers3

111
  1. Mark the "target" folders as "derived" resource from the properties screen of those folders (this option is next to read only and archive property).

  2. In the quick search (Ctrl+Shift+R) screen press the arrow in the top right corner and untick "Show derived resources".

Then those target-files will not be considered in the quick search anymore.

Chandrayya G K
  • 8,719
  • 5
  • 40
  • 68
Chris
  • 8,031
  • 10
  • 41
  • 67
44

Go to Add Resource Filter preferences dialog:

Go to ProjectPropertiesResourceResource Filters

Click Add Filter...

Then fill the options:

Filter type:

()Exclude all

Applies to:

()Folders

[X] All children (recursive)

Filter and Folder Attributes:

Name - Matches - [target]

Community
  • 1
  • 1
nilan59
  • 1,006
  • 9
  • 24
  • 4
    The best solution with no doubt. – shimatai Sep 15 '16 at 16:42
  • 5
    Our project is rather big and consists of three working sets with more than 200 subprojects which even change depending on the branch you're working on. Not a good solution for me to edit every single project. – Arigion Jul 05 '17 at 07:10
  • 3
    If you have imported your parent maven project all files are found twice (once with project path and once with parent project path). If you "Add Group - Exclude all, Files and Folders" it won't happen. – T3rm1 Feb 13 '18 at 14:43
  • 1
    Hello, can we do it for all projects in the workspace? – Bằng Nov 07 '19 at 08:33
1

You can install AutoDeriv plugin from Eclipse Marketplace or http://nodj.github.io/AutoDeriv/. It allows you to create either global(workspace) or per-project .derived files in which you can specify which files/folders should be marked as derived.

Here's a sample config file (taken from plugin's homepage):

# set the 'target' and 'ext' folders as derived
target
ext
# but don't affect the 'keep' sub-folder
!target/keep
# all files with a '.dep' extension are generated
*.dep
src/include/version.h # this specific file is also generated.
Dariusz
  • 21,561
  • 9
  • 74
  • 114
  • I'm, using that "AutoDeriv" plugin now and it correctly sets all the "target" folders as derived, but when I press ctrl+shift+R I'm still getting suggestions from files that are inside "target" folders (even from those of other projects that the current one sees)... And yes, I've unchecked the "show derived resources" flag... :( – nonzaprej Nov 26 '19 at 15:28