简体   繁体   中英

Eclipse does not search for files in Maven downloaded jar files

I am working in a Spring project with loads of maven dependencies. That project, is importing some xml files in the ApplicationContext.xml. For example:

<import resource="servers.xml" />

The project works fine, but I don't know in which jar file is that server.xml file.

I thought that with a resource search (Ctrl + Shift + R) I would be able to find it, but it looks like my Eclipse is not searching for regular files in the Maven downloaded jars. Is it an error from my workspace? Is there any way to search for xml files in dependency jars? Thanks for your help.

Imported resource files used in Spring applicationContext.xml can be "linked" using STS (Spring Tool Suite). For that, you have to enable support for <import /> elements. In order to do that

  • Right click in your project and click on properties
  • On the left, go to Spring->Beans Support
  • On "Config Files", click on "Enable support for <import /> element in configuration files
  • On the same screen, press on the "Scan" button from the right.It will get all the config files in the project.

With that, you should be able to "go" to the imported resources(via Ctrl + click) and discover in which jar file are they located.

I know it is not a perfect solution, but at lease it works while looking explicitly with Spring resources files.

Similar question : Eclipse: open declaration/resource for spring beans and contexts

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM