Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Force Eclipse to ignore tests classes for Java search

Tags:

java

eclipse

I've got following structure in Eclipse project

  - /src/main/java
  - /src/test/java

When I open call hierarchy or using java search, search result contains classes from /src/test/java classes. The same true for type hierarchy and others searches.

There are numbers of unit tests and I don't want to see classes from /src/test/java packages in search result.

The most straightforward way - simply exclude it from build path. Also there are filters for call hierarchy, however I was not able to find them for simple java search. Also filters relies on name pattern, which is not very good though.

I am looking for more convenient way

like image 1000
Anton Avatar asked Jul 10 '13 08:07

Anton


1 Answers

Right click on your test folder, go to properties and check the "Derived" checkbox. Then click ok.

enter image description here

Or you can create 2 working sets. 1 set for your code and a second one for your tests. Then when you search, you can search only the working set that holds the code.

  • Open Search dialog (ctrl+h)
  • Change search scope to Working Set
  • Click Choose ...
  • Click New to create a new Working Set with the what you want searched (or Add All and then remove the ones you want filtered
like image 52
JREN Avatar answered Nov 14 '22 11:11

JREN