I was debugging a certain thing in a maven project in Eclipse IDE. As usual when I stepped into (F5) a line, I reached a java class/file Persistence.class. I want to determine which jar did it come from.
The reason : There are two projects (existing) which have certain dependencies configured in pom.xml. I see two different source codes for the file – one of them gives the desired result while the other does not. I have tried looking for persistence-api, ejb etc. but didn’t find any of them in the Maven dependencies shown in eclipse.
Hence, I want to grep the poms (of parent projects) to look for the jar.
To Summarize, Is there a view in Eclipse where I can see which jar a .class file is coming from?
Activate “Link with editor” in the Package Explorer (the double arrow) and press F3. Eclipse expands the class in a library. (Make sure, that the editor, that shows
Persistence.classhas the focus).For the next step, assuming you use m2eclipse, open the pom editor and look at the Dependency Hierarchy Tab. That gives a first hint where the dependency comes from. It may be transitive.