使用Maven管理Jar包和查看第三方Jar包源代码

发布于 2014-05-17 | 更新于 2020-09-20

用maven管理Jar包很方便,代码存入远程仓库也不用因为Jar文件太大而占用太多的空间。还有一个好处是可以自动下载第三方jar包的源码,不过会出现下载不到的情况,这个时候需要检查一下环境。

eclipse的设置:

勾选windows-Preferences-Maven-Download Artifact Sources 这个选项

下载源码包的方法:

使用maven命令行下载依赖包的源代码:

mvn dependency:sources
mvn dependency:sources -DdownloadSources=true -DdownloadJavadocs=true

-DdownloadSources=true 下载源代码Jar -DdownloadJavadocs=true 下载javadoc包

如果执行后还是没有下载到,可以到仓库上搜一下,比如我这里搜的这个:

spring-data-jpa-1.2.0.RC1-sources.jar

http://search.maven.org/#search|gav|1|g%3A"org.springframework.data" AND a%3A"spring-data-jpa"

下载下来放到本地仓库,在eclise里面设置下关联就可以了。

本文作者: arthinking

本文链接: https://www.itzhai.comuse-maven-manage-jar-and-lookup-sourcecode.html

版权声明: 版权归作者所有,未经许可不得转载,侵权必究!联系作者请加公众号。

×
IT宅

关注公众号及时获取网站内容更新。