How to resolve “Source not found” when debugging in Eclipse
When you are debugging in Eclipse, sometimes when you debug into a method, you will meet with “Source not found” message, for example below.
In my example, this is because the corresponding source code for AbstractTypeHierarchyTraversingFilter does not exist in local workspace. The source code could not be automatically downloaded via “Maven -> Download Sources”.
[Note] This very issue in this example could also be resolved by changing dependency configuration in pom.xml. Please read this blog about what exactly should be defined in pom.xml if different Spring component is planned to be used in your application. In my example, after I add the missing dependency “spring-core” in pom.xml and re-download source via Maven plugin, the source code is then visible in debugger.
Solution
1. Google with keyword as below:
Click the first hit web page.
2. Go to the corresponding download page for your spring framework version:
You could find your Spring version in pom.xml, dependency block:
3. Download the .java source file.
Create a series of nested folders whose hierarchy exactly match the package declaration in java file. In my example, the folder structure should look like below:
Then make a zip file based on this folder.
4. Click “Change Attached Source…” to load the zip file created in step3.
After that the source code of AbstractTypeHierarchyTraversingFilter is visible in debugger now.