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.

2
  • 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, 2011 at 14:25
  • 1
    Related: Exclude folders from Eclipse search
    – blahdiblah
    Sep 27, 2012 at 21:36

3 Answers 3

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.

2
  • 15
    what when the target gets recreated through external mvn clean install
    – jmj
    Jul 24, 2013 at 19:28
  • 1
    does not work for me. Eclipse version: 2022-06 (4.24.0)
    – Gernot
    Aug 17, 2022 at 13:39
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]

4
  • 4
    The best solution with no doubt.
    – shimatai
    Sep 15, 2016 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 5, 2017 at 7: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, 2018 at 14:43
  • 1
    Hello, can we do it for all projects in the workspace?
    – Bằng
    Nov 7, 2019 at 8: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.
1
  • 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, 2019 at 15:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.