Drill Deeper into Jarrrrrs
Finding occurrences of a string or usages of a symbol across a project is a rather common task. However, it becomes less evident, if the goal of your search is hidden inside an archive. IntelliJ IDEA helps you easily drill into directories, libraries, zip or jar files.
Let’s
consider two cases of search in archives:
- Finding a text string
- Finding usages of a symbol

After
clicking the Find button, the detected occurrences are displayed in the
Find tool window.
As for finding usages of a symbol inside library
sources, you have to define a dedicated scope. For this purpose, IntelliJ IDEA
suggests the Scopes dialog. You can
construct scopes in advance (Ctrl+Alt+S
->Scopes), or do it immediately in the Find Usages dialog (Alt+F7). This is how it's done:
Having invoked the search for usages of a selected
symbol, click the ellipsis button next to the Scope field:
In the Scopes dialog, create a new scope (for
example, LibraryScope) and populate it with module directories and library
archives. Note that library classes and sources should be already defined and
attached in the project settings. Though you can type the scope pattern
manually, it is much easier to select the desired entries from the list. For
your convenience, you can group entries by modules, or by scope types:

As you
include or exclude the desired archives and packages, IntelliJ IDEA constructs the corresponding scope pattern:

After applying changes
and closing the Scopes dialog box, click
the Find button, and view results in
the Find tool window.
- Irina Megorskaya's blog
- Login or register to post comments
- 593 reads
- Printer-friendly version
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)









