Issue
I'm posting this query after doing lots of googling and trying out different options for last few days. Is there an easy way to attach source in Eclipse? is the closest answer I found to my question.
From above post, I tried all solutions but each time Eclipse is opening .class file instead of .java file.
Eclipse Details:
- Kepler Service Release 2
- Build id:20140224-0627
Please let me know if this is a bug with Eclipse or if I am missing something.
Solution
Maven is likely supplying a Classpath Container
to your project, and generating entries for the Java Build Path
based on the pom.xml contents (the JRE System Library
is another example of this). Its entries will not have source attachment unless the container decides it will, which is why the Installed JREs
preference page offers to let you set Source Attachments
. If the pom.xml has something like that, see if you can use it. If not, see if you can configure the Maven container from its context menu. Otherwise, you may simply be stuck.
Answered By - nitind
Answer Checked By - Willingham (JavaFixing Volunteer)