Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse not picking up Maven attached source on debug

Tags:

eclipse

maven

I've downloaded the source for all the Maven JARs in my buildpath using Maven->Download Sources and mvn eclipse:eclipse -DdownloadSources=true, which worked! When I open up the build path I can see that the sources JARs are attached for every JAR file.

But when I run the damn thing on Tomcat 6 I keep getting "Source not found" page with "Edit Source lookup path" button. But the source is already attached in the build path. What isn't this working?

When I manually point it to the JAR file by clicking on the "Edit Source lookup path" button it works. And when I manually point it to the folder it does not work. Why isn't Eclipse or Tomcat picking up the attached source in the build path?

Note: I'm using apache-maven-3.0.4, apache-tomcat-6.0.16 and Eclipse Indigo Service Release 2.

like image 903
user794783 Avatar asked May 13 '12 06:05

user794783


People also ask

How do I force Maven to download dependencies in Eclipse?

Via the Maven index, you can search for dependencies, select them and add them to your pom file. To download the index, select Windows > Preferences > Maven and enable the Download repository index updates on startup option. After changing this setting, restart Eclipse. This triggers the download of the Maven index.


3 Answers

Although this bug had the most votes of all bugs @Sonatype, it hasn't been fixed.

However I have filled an enhancement request on Eclipse Bugzilla and if you agree this issue "Source not found" should be fixed, please vote for it here.

You can found three workarounds here.

like image 176
ssasa Avatar answered Oct 14 '22 09:10

ssasa


I found this com.ifedorenko.m2e.sourcelookup plugin. The link was provided in "Java Debugging: Source not found".

Go to Help > Install New Software .. and use

http://ifedorenko.github.com/m2e-extras/

to search for the links. After installing this plugin I was finally able to debug the source code of dependencies.

like image 38
Stefan Falk Avatar answered Oct 14 '22 10:10

Stefan Falk


Use External Maven instead of default Embedded in Debug Configurations dialogue.

Please see example screenshot below (menu Run -> Debug Configurations...):

Configure external Maven

Tested environment:

  • Eclipse IDE for Java Developers: Oxygen.1a Release (4.7.1a), 64-bit (from spring.io)
  • Oracle JDK jdk1.8.0_144, 64-bit
  • Maven: 3.5.2
  • OS: Windows 10 Enterprise N, 64-bit
  • Test goal hpi:run (sample Jenkins plugin)
like image 45
Henryk Paluch Avatar answered Oct 14 '22 10:10

Henryk Paluch