11

when I click F3 and drill down into a method definition, eclipse goes into a dependency jar. ----- first question: where did it get the source file? I don't see the jars containing actual source files, did it decompile ? ---- I set a breakpoint, and run debug.

but the debugging process never seems to land on the correct breakpoint, and the breakpoint I set is rarely executed. it turns out that the source code shown is wrong, so that the breakpoint is set at wrong locations too.

here is what I see from eclipse window:

/*     */   public <T> T execute(URI url, HttpMethod method, RequestCallback requestCallback, ResponseExtractor<T> responseExtractor)
/*     */     throws RestClientException
/*     */   {
/* 415 */     return doExecute(url, method, requestCallback, responseExtractor);
/*     */   }`

the comment before each line seems to show the correct line number, but they do not match up with their true line number shown on the left of the eclipse window frame. i.e. the above code segment occupies lines 315--319 in the window, not 415.

so how can I grab the correct sources and display them in my debugging process? do I have to manually grab all the jars ? is there a way to specify in my pom file?

thanks Yang

4

3 回答 3

7

因为我google的时候没有找到解决方案,这是第一个搜索结果,我想分享一下我是如何解决这个问题的。

  1. 在 Eclipse 中,确保Project > Build Automatically选中;
  2. 右键单击您的项目并开始to Build Path > Configure Build Path...
  3. 检查选项卡中的错误(缺少依赖项、找不到源等),修复/删除它们,然后按 OK。
  4. 在 Eclipse 中,转到Project > Clean...,选择您的项目并按 OK;

如果您在第 3 步遇到错误(例如拒绝访问或类似情况),请转到项目的根文件夹并查找名为.classpath. 编辑文件并手动修复/删除导致错误的块。

这也解决了当 Eclipse 在有编译错误的类中不显示错误图标时。

于 2016-09-01T06:41:06.270 回答
6

在 Eclipse 中,您可以在 Run -> Debug Configurations 下指定调试源。从列表中选择您的调试配置并在“源”选项卡中配置源查找路径

于 2013-06-27T04:56:06.070 回答
0

我遇到了这个问题并且它发生了,因为我的.m2. 所以我通过删除不必要的版本来解决它。

默认位置是 - C:\Users\[username]\.m2\repository

于 2020-04-27T12:48:27.273 回答