Eclipse Maven debug - source not found

不想你离开。 提交于 2019-12-12 15:24:05

问题


I am trying to debug a JUnit test case within a Maven project in Eclipse on my local machine and I am getting a "Source not found" error on my own test class. I went through all the other similar threads that I could find about the problem, but to the best of my understanding none of them addresses exactly my same problem, nor a solution for it. So here is the detail of what I have done:

  1. Created a run configuration with the goals "-Dmaven.surefire.debug -Dtest=MyTestClass test"
  2. Created a remote Java application that connects to localhost:5005. Added the base folder for the project in the "Source" tab.
  3. Setup a breakpoint in MyTestMethod in MyTestClass. MyTestMethod has the @Test tag.
  4. Run the run configuration in 1. The application stops listening on port 5005.
  5. Debug the remote Java application in 2. The debugger window pops up and I see the thread with the stack trace of the classes where things are stopped. The debugger is stopped at the breakpoint that I setup. I can see the variables in this class and in other classes as well, but I get "Source not found" for MyTestClass. If I do "Edit source lookup path", my project is there as I added it in 2.

I am not sure what I am doing wrong. As an alternative, I have also tried to create another run configuration with -DforkMode=never. But if I try to debug that, I get the following error:

ERROR context.TestContextManager: Caught exception while allowing TestExecutionListener
 [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@2a46b75b]
 to prepare test instance [MyTestClass@8afcd0c]

Thanks.

来源:https://stackoverflow.com/questions/20106495/eclipse-maven-debug-source-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!