Anton
Anton

Reputation: 6041

Force Eclipse to ignore tests classes for Java search

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

Upvotes: 6

Views: 2094

Answers (1)

JREN
JREN

Reputation: 3630

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

Upvotes: 3

Related Questions