Ashutosh Jindal
Ashutosh Jindal

Reputation: 18867

Intellij: Search through the source of maven dependencies in a project

Is it possible to search for a bit of text through the source code of all the maven dependencies of a project?

For example: If you import the following sample maven project: https://github.com/ajorpheus/javadoc-mem-test/tree/search-in-jars, searching for tempHeaders should turn up AbstractClientHttpRequest.java as a search result.

Is there a plugin that allows one to do this?

If Intellij does not support this, would you know of an IDE-agnostic way to do this given a maven project? I have looked at tools like jarexplorer but they don't seem to do the job.

Upvotes: 44

Views: 37482

Answers (6)

Raymond
Raymond

Reputation: 71

First you need to download the source from maven tool bar

Upvotes: 0

Sidharth K.Burnwal
Sidharth K.Burnwal

Reputation: 546

I have faced the same problem. There is two way to search in Intellij.

1. Ctrl + shift + F

2. navigate - > search everywhere or use Ctrl + N

To search in external libraries , you have to make sure they are downloaded first in your system then only you can search anything among them.

Upvotes: 2

Diego4016
Diego4016

Reputation: 41

For IntelliJ 2020 go to the main menu, select Navigate | Search Everywhere or press Shift twice to open the search window.

For more information check here: https://www.jetbrains.com/help/idea/searching-everywhere.html#search_all

Search everywhere example

Upvotes: 1

aruis
aruis

Reputation: 751

in IntelliJ IDEA 2018, you can do this: ctrl+shift+f

enter image description here

thanks @Ashutosh Jindal

Upvotes: 22

geoand
geoand

Reputation: 64079

If I understand your requirement correctly, what you are trying to do is possible.

First in the Maven pane you need right click on dependencies and select 'Download Sources'.

Once that is done, follow Ashutosh Jindal instructions to search in your code and the dependencies code.

Upvotes: 9

Ashutosh Jindal
Ashutosh Jindal

Reputation: 18867

I found how to do this !

Use the 'Project and Libraries' Custom Scope.

enter image description here

Upvotes: 53

Related Questions