當在IDE中使用Maven時若是想要看引用的jar包中類的源碼和javadoc須要經過maven命令下載這些源碼,而後再進行引入,經過mvn命令可以容易的達到這個目的: java
mvn dependency:sources mvn dependency:resolve -Dclassifier=javadoc
命令使用方法:首先進入到相應的pom.xml目錄中,而後執行以上命令: shell
第一個命令是嘗試下載在pom.xml中依賴的文件的源代碼。 eclipse
第二個命令:是嘗試下載對應的javadocs maven
可是有可能一些文件沒有源代碼或者javadocs spa
reference code
打開maven配置文件 setting.xml文件 (.../.m2/settings.xml) 增長以下配置: xml
<profiles> <profile> <id>downloadSources</id> <properties> <downloadSources>true</downloadSources> <downloadJavadocs>true</downloadJavadocs> </properties> </profile> </profiles> <activeProfiles> <activeProfile>downloadSources</activeProfile> </activeProfiles>