能下载到源代码的原则是仓库中打了resource的jar包
1.使用命令
mvn dependency:sources 下载依赖包的源代码。
mvn dependency:sources -DdownloadSources=true -DdownloadJavadocs=true
mvn org.apache.maven.plugins:maven-dependency-plugin:2.8:get -Dartifact=javax.mail:mail:1.1:jar:sources
2.eclipse窗口
eclipse窗口->首选项->maven->勾选download artifact sources
eclipse的项目maven dependecies中选择对应的jar,右击->maven->download sources
3.在pom中设置插件
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
</configuration>
</plugin>