在java编程中,现在好多开源的第三方软件都使用maven管理了,比如经常使用的spring,在官网都找不到下载地址了,提供了maven的下载地址,有的时候想看看某些软件的源代码,maven也提供了下载源代码的功能,只要配置下就可以了,下面是详细步骤。
在装好了的maven的根目录,比如我的是d:/maven,打开conf/settings.xml文件,在<profiles> </profiles> 元素下加入子元素
<profile>
<id>downloadSources</id>
<properties>
<-- 下载源代码 -->
<downloadSources>true</downloadSources>
<-- 下载源代码的javadoc -->
<downloadJavadocs>true</downloadJavadocs>
</properties>
</profile>
然后,在 <activeProfiles> </activeProfiles> 加入
<-- 激活上面的配置的属性 -->
<activeProfile>downloadSources</activeProfile>
[size=large][color=red][b]step 2[/b][/color][/size]
在eclipse中配置下,window--perferences-maven,如下图
[img]http://dl2.iteye.com/upload/attachment/0109/2846/b372213c-806c-3c61-8a94-a34a4cf7d3d9.jpg[/img]
点击Apply,OK
[size=large][color=red][b]step 3[/b][/color][/size]
在eclipse中,选中pom.xml,右键,run as maven-clean,如下图,
[img]http://dl2.iteye.com/upload/attachment/0109/2848/44a76499-6a06-360e-86f9-a4a343025828.jpg[/img]
,稍等片刻,源代码就下载下来了,当然,这个有你的网速决定。