spring4.0源码下载

1、下载工具

下载最新的eclipse,因为最新版本的eclipse,自带git插件。已经有eclipse或者git的跳过此步骤。

http://www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/lunasr2

2、下载源码

打开eclipse,选择Windows——Preferences——Show View,找到Git Repositories,选择Clone 一个远程repositories。 在url输入框中输入如下地址,并设置一个本地地址,用于存放下载到得代码。

git://github.com/SpringSource/Spring-framework.git

这个过程比较慢,等下载完成后,在本地已经有了如下文件夹。


3、说明

spring不但将代码放在了git上,项目构建也改为由Gradle构建。所以,想把下载到得spring源码,转换成eclipse项目,还需要靠Gradle。幸运的是,我们刚才下载的文件中,已经包含了Gradle。

###NOTE###spring4.0源码构建项目,需要用到JDK1.8.0+,否则会失败,出现莫名奇妙的错误。

在刚才下载的文件中,有一个README.md文件,打开后,简单阅读。找到如下文字

## Building from Source
The Spring Framework uses a [Gradle][]-based build system. In the instructions
below, [`./gradlew`][] is invoked from the root of the source tree and serves as
a cross-platform, self-contained bootstrap mechanism for the build.


### Prerequisites


[Git][] and [OpenJDK 8 early access build 100 or later][JDK8 build]


Be sure that your `JAVA_HOME` environment variable points to the `jdk1.8.0` folder
extracted from the JDK download.



### Check out sources
`git clone git@github.com:spring-projects/spring-framework.git`


### Import sources into your IDE
Run `./import-into-eclipse.sh` or read `import-into-idea.md` as appropriate.
> **Note:** Per the prerequisites above, ensure that you have JDK 8 configured properly in your IDE.


### Install all spring-\* jars into your local Maven cache
`./gradlew install`


### Compile and test; build all jars, distribution zips, and docs
`./gradlew build`


... and discover more commands with `./gradlew tasks`. See also the [Gradle
build and release FAQ][].


<span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);">下载jdk1.8,注意下载和自己操作系统匹配的版本</span>
<span style="font-family: Arial, Helvetica, sans-serif;">http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html</span>

下载安装后,记得添加环境变量

4、构建项目

双击 import-into-eclipse.bat ,开始构建项目。

###NOTE### 可能由于网络原因,导致下载jar包的时候,会卡住或者中断。这个时候重新双击 import-into-eclipse.bat ,如果再卡住就关掉再点。直到提示BUILD SUCCESS。然后按几次回车后,完成。

5、项目导入eclipse

把spring的项目依次导入eclipse中。如下图


有报错,提示 

GroovyDynamicElementReader cannot be resolved to a type

说明少groovy的jar包。

安装一个eclipse的groovy插件
在eclipse的 Help -> Install New Software 中,添加groovy的下载连接:
http://dist.springsource.org/milestone/GRECLIPSE/e4.4/
然后全选后,开始下载,下载完后,重启eclipse,然后clean一下项目就搞定了。

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值