Eclipse java debugging: source not found

2019-01-01 02:55发布

While debugging a java app in eclipse I receive a "Source not found" error in two cases:

  • Stepping in to a file in a different project which is already imported
  • Stepping in to a file in an installed maven repository

The files are there, but eclipse won't step into them, instead it shows a button to "attach source"

I tried attaching (which opened a dialog to define a variable?!) and eclipse did jump to the file, but the debugger could not inspect any variables there. Also manually attaching the source for each dependency isn't practical, as in my case there are thousands of dependency files.

I'm new to eclipse\java so an explanation of why this is happening + how to resolve this would help a lot!

29条回答
梦醉为红颜
2楼-- · 2019-01-01 03:44

I had similar problem with my eclipse maven project. I fought with this issue quite a long time then I tried to rebuild projet with

mvn clean eclipse:eclipse

and it helped.

查看更多
零度萤火
3楼-- · 2019-01-01 03:44

If you want to attach source code to any JAR by auto-downloading, try using this Eclipse plugin Java Source Attacher

enter image description here

查看更多
浪荡孟婆
4楼-- · 2019-01-01 03:45

In my case problem was resolved by clicking Remove All Breakpoints

查看更多
谁念西风独自凉
5楼-- · 2019-01-01 03:47

In my case in "Attach Source", I added the other maven project directory in the "Source Attachment Configuration" panel. Adding the latest version jar from the m2 repository din't work. All the classes from the other maven project failed to open.

enter image description here

Here test was my other maven project containing all the java sources.

查看更多
大哥的爱人
6楼-- · 2019-01-01 03:47

In my case the Maven version of the other referenced project didn't match the version of the test project. Once they were the same, the problem disappeared.

查看更多
时光乱了年华
7楼-- · 2019-01-01 03:47

I had this problem while working on java code to do process on a excel file containing a data set, then convert it to .csv file, i tried answers to this post, but they did not work. the problem was the jar files themselves. after downloading needed jar files one by one(older releases) and add them to my project, "source not found" error vanished. maybe you can check your jar files. hope this would help.

查看更多
登录 后发表回答