0

I am using Eclipse Oxygen. Everything was working fine until one day I imported a Spring Boot maven project which has problem in pom.xml saying that tools.jar is missing. In the process of trying to remove this error I messed around with build path and many things. Now Eclipse is no longer able to automatically attach sources and I have to manually attach the source. For example, see below image

Source not found

The source jar file actually exist but eclipse is not able detect it.

Source files

I have to manually click the "Attach Source" and locate the source file, and then only the source code is attached. Eclipse should be doing this under the hood. I googled a lot but all solutions given were not working for me. Please help.

Mawia
  • 4,220
  • 13
  • 40
  • 55
  • A couple of suggestions, have you tried with a new dummy project and / or a new workspace? Will help figure out if the problem is with something you changed in the project or the workspace, and can then delve deeper from there. – Brian Fernandes Mar 11 '19 at 07:07
  • In _Project > Properties: Java Build Path_, tab _Libraries_ is there still _Maven Dependencies_? – howlger Mar 11 '19 at 07:35
  • I think I found the problem. I deleted all the files from above maven repo folder and let eclipse download fresh files again, and now the source is attached. It looks like the **files were corrupted** but I have no idea how it happened. Now I think I'll have to clean all repo folders that have this problem, which may take a lot of time. I wish there is an easy way. – Mawia Mar 11 '19 at 07:37
  • 1
    I was wrong. Problem is still there within Spring boot project. It looks like a Spring Boot issue. I'm getting more confused. :( – Mawia Mar 11 '19 at 07:51
  • 1
    @Mawia File corruption happens because there was a concurrency issue in m2e fixed here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=534228. You should update, because it will happen again, and it is painful to debug. Easy way to clean is to just remove the entire .m2 folder and let Maven download it again. I'm not exactly sure what is the exact issue, here is a couple of tips: you could check Settings->File association->class file (should be class file viewer. Consider installing Enhanced class decompiler, it should fix the issue when no sources found (and attach when downloaded). – helospark Mar 11 '19 at 09:40

0 Answers0