Java Intellij:搜索项目中maven依赖的来源
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23128952/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Intellij: Search through the source of maven dependencies in a project
提问by Ashutosh Jindal
Is it possible to search for a bit of text through the source code of all the maven dependencies of a project?
是否可以通过一个项目的所有maven依赖的源代码搜索一些文本?
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.
例如:如果您导入以下示例 maven 项目:https: //github.com/ajorpheus/javadoc-mem-test/tree/search-in-jars,则搜索tempHeaders
应该会AbstractClientHttpRequest.java
作为搜索结果出现。
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 jarexplorerbut they don't seem to do the job.
如果 Intellij 不支持这一点,那么在给定 Maven 项目的情况下,您是否知道一种与 IDE 无关的方法来执行此操作?我看过像jarexplorer这样的工具,但它们似乎并没有完成这项工作。
采纳答案by Ashutosh Jindal
I found how to do this !
我找到了如何做到这一点!
Use the 'Project and Libraries' Custom Scope.
使用“项目和库”自定义范围。
回答by geoand
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'.
首先在 Maven 窗格中,您需要右键单击依赖项并选择“下载源”。
Once that is done, follow Ashutosh Jindal instructions to search in your code and the dependencies code.
完成后,按照 Ashutosh Jindal 的说明搜索您的代码和依赖项代码。
回答by aruis
in IntelliJ IDEA 2018, you can do this: ctrl+shift+f
在 IntelliJ IDEA 2018 中,您可以这样做:ctrl+ shift+f
thanks @Ashutosh Jindal