当在IDE中使用Maven时若是想要看引用的jar包中类的源码和javadoc须要经过maven命令下载这些源码,而后再进行引入,经过mvn命令可以容易的达到这个目的:html
mvn dependency:sourcesjava
mvn dependency:resolve -Dclassifier=javadocapache
命令使用方法:首先进入到相应的pom.xml目录中,而后执行以上命令:eclipse
第一个命令是尝试下载在pom.xml中依赖的文件的源代码。maven
第二个命令:是尝试下载对应的javadocsui
可是有可能一些文件没有源代码或者javadocsspa
打开maven配置文件 setting.xml文件(.../.m2/settings.xml) 增长以下配置:.net
<profiles> <profile> <id>downloadSources</id> <properties> <downloadSources>true</downloadSources> <downloadJavadocs>true</downloadJavadocs> </properties> </profile> </profiles> <activeProfiles> <activeProfile>downloadSources</activeProfile> </activeProfiles>
Window > Preferences > Maven and checking the "Download Artifact Sources" and "Download Artifact JavaDoc" optionscode
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-eclipse-plugin</artifactId> <configuration> <downloadSources>true</downloadSources> <downloadJavadocs>true</downloadJavadocs> </configuration> </plugin> </plugins> </build>
如下可做为参考的相关连接:xml
http://www.blogjava.net/itspy/archive/2011/09/07/358233.html
http://stackoverflow.com/questions/2059431/get-source-jars-from-maven-repository