Eclipse Resource Filtering using 'Derived'

March 27, 2006

Once in a great while you stubble upon a tip that provides a solution to a problem you had all but given up on. Today I will pass on a tip in hopes that it provides you with the same result as it did for me.

As the author of this blog entry describes, often times Eclipse is a bit too helpful in the options it presents to you when searching for a resource (non-java file) to open via the Ctrl-Shift-R key command. The extra options include working directories for both external tools, such as maven, as well as Eclipse itself. One of the most common examples is the .deployables directory that Eclipse used for web projects prior to WTP 1.0.

The trick is to open the "Navigator" view, right click on the folder to be ignored, and check the "Derived" property. This option informs Eclipse that this folder consists of generated resources that should not be directly edited. Once this is done, the "Open Resource..." view will only show matches that would be relevant to the developer.

Posted at 09:04 AM in Java | Permalink Icon Permalink

12 Comments from the Peanut Gallery

1 | Posted by Dan Allen on March 28, 2006 at 04:07 PM EST

Does anyone know where Eclipse stores this derived flag? I tend to setup scripts to configure my Eclipse environment, but I cannot figure out how to automatically set this property on my maven2 target folders.

2 | Posted by Fulano on November 29, 2006 at 08:19 AM EST

Great, a simple yet very useful trick. Thanks so much!!!

3 | Posted by leycec on May 10, 2007 at 01:45 PM EST

Monstrously helpful! Thank you so much.

4 | Posted by Frydek on September 17, 2007 at 05:35 PM EST

I've been looking this for months! thanks dude!

5 | Posted by Jon Chase on November 08, 2007 at 08:50 AM EST

Great! I've been dying to figure out how to filter out all of those maven generated artifacts. Thanks! Jon

6 | Posted by Priit on November 23, 2007 at 04:18 AM EST

Here is description for eclipse monkey script that does that:

Eclipse monkey script information

7 | Posted by Dan Allen on November 24, 2007 at 04:01 PM EST

Great resource Priit! I'm glad that we are moving towards automation for this setting because it is a pain to have to remember to set it up after each clean build.

8 | Posted by Servlet on December 01, 2008 at 06:11 AM EST

Very very useful, This is exactly what I was looking for. I wanted to exclude the build and bin directories..

Helped a lot

9 | Posted by Fal on January 08, 2009 at 07:17 PM EST

Was very helpful !! Thanks !!

10 | Posted by Grappa on February 25, 2009 at 06:45 PM EST

Is there a way to have "Show derived resources" un-checked by default?

11 | Posted by Todd Jonker on July 29, 2009 at 04:40 PM EST

This would be more useful if Eclipse would actually persist that setting between runs. Does anybody know why it doesn't save that setting?

12 | Posted by YA2O on January 23, 2012 at 08:41 AM EST

I have been so pissed by this problem that I wrote a plugin to solve it. When you click on the plugin's icon, all target folders (in opened projects) will be marked as derived. You can get the source and jar from:

https://github.com/YA2O/Eclipse_Plugin_Target_Derivator