您的位置:首页 > 编程语言 > Java开发

Spring源码-将源码导入到eclipse

2017-07-31 18:13 375 查看


关于Spring Framework源码的学习从今天就要开始了。首先,要把源码导入IDE中。可是源码下载后,发现工程下只有src目录,eclipse导入不了这样的工程。在网上看了许多导入教程后,发现教程太麻烦,而且还可能出错。所以我直接按照Spring Framework的README.md中的内容操作了一下,竟然一次成功



环境准备

GIT。

JDK1.8,配置好相关环境变量。我使用的是1.8.0。

eclipse。下载地址:http://www.eclipse.org/downloads/

网络畅通。

操作步骤

1.下载源码

从GitHub上下载源码,https://github.com/spring-projects/spring-framework,执行git命令:

git clone git@github.com:spring-projects/spring-framework.git


下载代码大约需要30min-60min,请耐心等待☺。

2.编译

源码下载好后,进入源码的spring-framework目录,找到import-into-eclipse.bat文件,运行。

大约需要30min~60min,请耐心等待☺。

build完之后,如果成功结果是这样的:



如果环境准备好的话,应该是不会出错的,我当时build一下就成功了。

3.导入build后的源码到IDE中

具体该怎么操作,build完之后,Spring已
4000
经贴心的提醒我们了,不信你看上图?build完后,就已经提醒我们下一步该怎么走了

STEP 2: Import subprojects into Eclipse/STS

Within Eclipse/STS, do the following:

File > Import... > Existing Projects into Workspace
> When prompted for the 'root directory', provide E:\GitHub\spring-framewor
k\
> Press enter. You will see the modules show up under "Projects"
> All projects should be selected/checked. Click Finish.
> When the project import is complete, you should have no errors.

When the above is complete, return here and press the enter key.


注意,图中的步骤里有这么一行

All projects should be selected/checked. Click Finish.


建议导入所有的工程。

3.1 GroovyDynamicElementReader.java错误处理

导入后,发现GroovyDynamicElementReader.java报错



原因是没有安装groovy插件,要安装一个eclipse的groovy插件。

Groovy官方对于Eclipse安装Groovy插件的网址是:https://github.com/groovy/groovy-eclipse/wiki



在eclipse的 Help -> Install New Software 中,根据你的eclipse版本添加对应的groovy的下载链接,如http://dist.springsource.org/milestone/GRECLIPSE/e4.4/,插件列表中选择Required。(ps:如果全部选择,可能要下载很长时间)



开始下载安装,下载安装后,重启eclipse,然后clean一下工程,一般错误就消失了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: