Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse file search finds the same file multiple times

Tags:

eclipse

maven

In Eclipse I have two maven projects A and B, where A is a parent for B. The directory structure is the following:

A/pom.xml A/B/pom.xml A/B/... 

Then I use File search (Ctrl+H) to find any file in the project B. The search result window shows the file two times with different relative paths:

A/B/<my_file> B/<my_file> 

So, the same file is shown twice. Obviously, the first search result is reduntant. Is there a way to exclude these duplicate search results?

like image 635
ZhekaKozlov Avatar asked Feb 25 '13 10:02

ZhekaKozlov


People also ask

How do I search everything in Eclipse?

Clicking on the Search menu and selecting Search or File or Java. Clicking Ctrl + H.

How do I search multiple files in Eclipse?

CTRL + SHIFT + R –> used to search all types of files (Open Resource) CTRL + H –> opens dialog box which provides number of options (Search)

How do I open a new tab in Eclipse?

To open a new window, click on the Windows menu and select the New Window menu item. Each window can have a different perspective open in them. For example you could open two Eclipse windows one in the Java perspective and the other in the Debug perspective.


2 Answers

What I personally do to avoid this is marking each module in the parent project as derived (right-click on the folder > properties > Attributes: Derived).

Then when you perform a file search, uncheck "Consider derived resources" (I don't think it is checked by default) and you won't get the A/B/<my_file>.

The only inconvenience is that you must do this for each module, and each time a new module is added.

like image 86
Didier L Avatar answered Sep 20 '22 20:09

Didier L


In an open resource window (cntrl+shift+R), click on the arrow on top-right and check "Filter Duplicated Resources". This worked for me.

like image 21
Santosh Sawant Avatar answered Sep 21 '22 20:09

Santosh Sawant