一种方法用命令行:mvn dependency:sources或者mvn dependency:sources -DdownloadSources=true -DdownloadJavadocs=true,会下载源码在jar包相同路径。 若没有生效可以尝试clean,然后就ok了。
另外一种在eclipse中,window->preference->maven->勾选download artifact sources,以及java doc
第三种在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>