Maven – Always download sources and javadocs
Open your settings.xml file ~/.m2/settings.xml
(create it if it doesn't exist). Add a section with the properties added. Then make sure the activeProfiles includes the new profile.
<settings>
<!-- ... other settings here ... -->
<profiles>
<profile>
<id>downloadSources</id>
<properties>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
</properties>
</profile>
</profiles>
<activeProfiles>
<activeProfile>downloadSources</activeProfile>
</activeProfiles>
</settings>
In my case the "settings.xml" solution didn't work so I use this command in order to download all the sources:
mvn dependency:sources
You also can use it with other maven commands, for example:
mvn clean install dependency:sources -Dmaven.test.skip=true
To download all documentation, use the following command:
mvn dependency:resolve -Dclassifier=javadoc