2

There are plenty of similar questions in stackoverflow, like Get source JARs from Maven repository, Maven – Always download sources and javadocs, etc.

Follow the instructions suggested by those answers, Eclipse still can't download source code of jar package, but javadoc has been downloaded.

Does someone can tell me why? I fell quite confused.

Community
  • 1
  • 1
Tangoo
  • 1,329
  • 4
  • 14
  • 34
  • Esse erro já estar aberto aqui a bastante tempo, porém quero descrever a solução que fiz em meu projeto, Hoje dia 02/06/2020 Passei pelo mesmo erro resolvi apagando a pasta .m2 do maven no caminho C:\Users\NOME_DE_USUARIO_DO_SEU_COMPUTADOR .m2 pronto eu apaguei essa pasta e execultei maven update force. – Renato Jun 02 '20 at 22:06
  • Could you please use English in your comments? – PaulN May 11 '21 at 14:06

2 Answers2

7

I believe that you are using an embedded version of maven.

There are two items you need to check:

  1. Check if the options in Eclipse are selected as screen bellow

enter image description here

The second approach is to select an external installation of maven.

Take a look in the screenshot bellow. I'm using an external installation of maven.

enter image description here

In the second approach maven will read the settings.xml of external installation.

josivan
  • 1,963
  • 1
  • 15
  • 26
  • 1
    Thx for your time, after check the local repository, I find that the `xxx-source.jar` has been downloaded for the `xxx.jar`, but `xxx-source` just don't show up in the Eclipse, what can I do? – Tangoo Mar 04 '16 at 06:05
  • On open a .class file, click on "Attach Source" button. Then select the xxx-source jar file in maven repository. – josivan Mar 04 '16 at 11:33
  • I am behind a firewall. The above was not good enough. I had to do this https://stackoverflow.com/a/2430107/3124333 first, and then Eclipse was able to pick the sources up with no problem. – SiKing Sep 01 '17 at 22:49
2

There are few ways you can do it

1. mvn eclipse:eclipse -DdownloadSources
2. mvn dependency:sources

3. or below in pom.xml

<properties>
  <downloadSources>true</downloadSources>
  <downloadJavadocs>true</downloadJavadocs>
</properties>
Girdhar Singh Rathore
  • 5,030
  • 7
  • 49
  • 67
  • 1
    Step 2 (`mvn dependency:sources`) was the one that helped. Changing Eclipse preferences or setting the properties in pom.xml had no influence in my environment. – S. Doe Dec 07 '21 at 11:33