如何让eclipse“文件搜索”功能生效还要在包含一些文本的源罐子中搜索?
我正在开发一个(Java)项目,其中有许多罐子,其中附加了源罐子文件。
有没有什么方法可以让 eclipse“文件搜索”搜索包含这些源 jar 中的一些字符串文字的 Java 文件(以及 txt、xml 等),而不仅仅是在项目文件夹中?
或者有没有什么插件可以实现这个功能?
I am working on a (Java) project in which I have many jars which have a source-jar file attached.
Is there any way to make the eclipse "File Search" search for Java files (and txt, xml etc. for that matter) containing some string literal inside these source jars, not just in the project folder?
Or is there any plugin by which this can be achieved?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
最近发现以下插件具有用于搜索链接源 jar 的测试版支持: https://github.com/ajermakovics/ eclipse-instasearch
您必须在首选项中启用搜索源 jar,因为默认情况下它是关闭的。根据您拥有的源数量,索引过程非常慢,但搜索速度非常快。
我有一个 Eclipse 工作区,其中包含企业版 Alfresco(Explore、Share 和 SOLR)和 Alfresco Workdesk(Vanilla、Office 和 Mobile)。在我的 2011 年初的 MacBook Pro 上,索引编制大约需要 8 分钟。搜索几乎是即时的。
Recently discovered the following plugin has beta support for searching into linked source jars: https://github.com/ajermakovics/eclipse-instasearch
You have to enable searching source jars in the preferences as it is turned off by default. Depending on how much source you have, the indexing process is very slow, but then search is very fast.
I have an Eclipse workspace with the enterprise versions of Alfresco (Explore, Share and SOLR) and Alfresco Workdesk (Vanilla, Office and Mobile). Indexing took about 8 minutes on my Early 2011 MacBook Pro. Search is almost instantanious.
使用 WinRar 搜索在 jar 内搜索或查找包含特定文本的类名非常容易。它很有效率,至少对我来说总是有效。
只需在 winrar 中打开任何 jar,单击“..”,直到到达要开始搜索的顶部文件夹(包括子文件夹)。
确保选中以下选项:
1.) 在“要查找的文件名”、“存档类型”字段中提供“*”
2.) 选中“在子文件夹中查找”、“在文件中查找”、“在存档中查找”复选框'。
Searching inside a jar or finding the class name which contains a particular text is very easy with WinRar search. Its efficient and always worked for me atleast.
just open any jar in winrar, click on ".." until you reach the top folder from where you want to start the search(including subfolders).
Make sure to check the below options:
1.) Provide '*' in fields 'file names to find', 'Archive types'
2.) select check boxes 'find in subfolders', 'find in files', 'find in archives'.
不可能,使用 Total Commander 在 jar/zip 等中搜索。
Is not possible, use Total Commander to search in jar/zip etc.
你可以这样做。按 ctrl-h --> java search(类似于文件搜索的选项卡)--搜索:字段
限制为:所有出现的情况
范围:工作空间
然后按搜索按钮
you can do like this. press ctrl-h -- > java search(the tab like file search)--search for: Field
limit to:all occurrences
scope:workspace
then press search button
目前还没有 Eclipse 插件可以做到这一点。但是,您可以编写一个简单的实用程序来完成这项工作:
其中 filePath 是您感兴趣的路径。
目前它只能从类路径的根目录查找资源。例如,如果有文件 config/settings.xml,您可以使用“config/settings.xml”找到,但不能使用“settings.xml”找到。
希望它会有所帮助。希望有人能够增强代码并创建 Eclipse 插件。
Currently there is no Eclipse plugin can do this AFAIK. However you can write a simple utility to do the work:
Where filePath is the path you are interested.
Currently it will only find resources from root of class path. E.g. if there is a file config/settings.xml, you can find with using "config/settings.xml", but not "settings.xml".
Hope it will help. And hopefully someone will enhance the code and create an Eclipse plugin.
您可以在附加到工作区的源 jar 中搜索代码。只需使用 ctrl+H / Java 搜索即可。但是我找不到在这些源中搜索注释和 java 文档的方法。
You can search for code inside source-jars attached to your workspace. Just use ctrl+H / Java Search. However I couldn't find a way to search for comments and java-docs inside those sources.
实现这一目标的最实用的方法是扩展您需要搜索的所有 jars/其他档案 - 如果它们太多,则使用简单的脚本进行自动化。将文件放入一个文件夹中并从中创建一个通用 Eclipse 项目,或者将其放入现有 java 项目的子文件夹中(当然不将其设为资源)。然后,您可以使用 Ctrl-H 进行搜索,使用 Ctrl-R 按名称查找资源。
查看结果:
The most practical way of achieving this is to expand all the jars / other archives you need to search in - using simple script to automate if they are too many. Put the files in a folder and create a generic Eclipse project from it or just put it in a sub-folder to your existing java project (without making it a resource of course). Then you can use Ctrl-H to search in and Ctrl-R to find resources by name.
See the result:
您可以通过以下方式实现此目的:
“文件搜索”对话框中有一个下拉菜单。
它的标签是:“文件名模式”。
您可以在此处指定要搜索的整个文件名以及文件扩展名。
You can achieve this by this way:
There's a dropdown in the 'File Search' dialog.
Its label is: 'File name patterns'.
Here you can specify the whole filename as well as extension of file, that you want to search in.