http://zachary-guo.iteye.com/blog/661839
Spring 3 正式发布已经有好长时间了,第一次从 SVN 拿下源代码进行编译,总是编译不过。事实上,Spring Team Blog 上已经有一篇关于构建 Spring 3 的文章,但按照文章说的一步一步的来做时,不是这里出了问题就是那里出了一点小差错。其实,只要仔细阅读这篇文章,按它说的步骤来实践的话,只要你足够细心,最终是会成功的。这里,我将 Spring Team Blog 上的这篇文章中我们需要注意的地方列出来,作为学习笔记,供大家参考。
● JDK
使用 Spring 3,至少需要 Java 5;编译 Spring 3,至少需要 Java 6。如果你的机器上装了 N 多个版本的 JDK,请确保环境变量中的那个 JDK 的版本不低于 6.0。
● Ant
Ant 1.7 or later。
● 设置 JAVA_OPTS 和 ANT_OPTS
设置环境变量,这依赖于你的机器的配置。要提供 JVM 足够大的内存,否则编译过程中会出现内存溢出。参考设置如下:
- JAVA_OPTS=-Xms512m -Xmx1024m -XX:MaxNewSize=512m -XX:MaxPermSize=1024m
- ANT_OPTS=-Xms256m -Xmx768m -XX:MaxNewSize=256m -XX:MaxPermSize=512m
JAVA_OPTS=-Xms512m -Xmx1024m -XX:MaxNewSize=512m -XX:MaxPermSize=1024m
ANT_OPTS=-Xms256m -Xmx768m -XX:MaxNewSize=256m -XX:MaxPermSize=512m
在以上三点确保的情况下,可以继续下面的操作了,基本上编译不会出现什么问题了。
● Check out the sources
Check out the sources from https://src.springframework.org/svn/spring-framework/trunk/
● Build
使用 ant 来 build,它会通过 ivy 来下载 Spring 3 所依赖的第三方 jar 包。这段时间你可以喝杯咖啡或是小憩一会。
- ---> cd ${SRC_HOME}/build-spring-framework
- ---> ant
-
- Hava a rest......
-
- [......]
- BUILD SUCCESSFUL
---> cd ${SRC_HOME}/build-spring-framework
---> ant
Hava a rest......
[......]
BUILD SUCCESSFUL
接下来要做的,就是将 Spring 3 的源代码导入到 Eclipse 中来。
● Create the IVY_CACHE classpath variable
Spring 3 的整个工程依赖于 IVY_CACHE 这个环境变量,它其实就是 ant build 时创建的 ivy-cache 目录,这里面都是 Spring 3 所依赖的第三方 jar 包。
Window -> Preferences -> Java -> Build Path -> Classpath Variables -> New:
- Name=IVY_CACHE
- Path=${SRC_HOME}/ivy-cache/repository
Name=IVY_CACHE
Path=${SRC_HOME}/ivy-cache/repository
● Set the workspace default JRE to Java 6
Window -> Preferences -> Java -> Installed JREs,确保选中的是 Java 6。
● Import sources into Eclipse
File -> Import -> Existing Projects into workspace,root directory 选择 ${SRC_HOME}。
● 结束语
至此为止,构建结束。此时,还是会发现 Eclipse 中有若干个工程构建失败,查看原因,是由于 aop,orm,web 这三个工程的的 Build Path 的 ivy 路径有点问题,我干脆删除,就可以了。还有一种方式时补齐 ivy 的路径,这个不影响整个 Spring 3 的构建。但我还是有点不明白,Spring 开发团队在 Eclipse 中使用这样的 ivy 路径难道不报错吗?
分享到:
相关推荐
Spring 5.0 Cookbook Recipes to build, test, and run Spring applications efficiently 英文azw3 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除
How to build Spring-based web applications using Spring MVC and more How to build Spring-based front ends How the Spring Framework can work with scripting languages like Groovy to provide enhanced ...
build-spring-framework
Baeldung Build Your REST API with Spring 5 video course
spring-build-src-4.0.0.RELEASE.jar
This book will help you understand what Spring Boot is, how Spring Boot helps you build Spring-based applications quickly and easily, and the inner workings of Spring Boot using easy-to-follow ...
spring-cloud-build:Spring Cloud模块的常见构建问题,共享插件配置等
Baeldung Build Your REST API with Spring 5 Course
Spring Microservices_Build Scalable Microservices with Spring,Docker, and Mesos
Mastering Spring Cloud_Build self-healing, microservices-based, distributed systems using Spring Cloud-Packt Publishing(2018)
This book will help you understand what Spring Boot is, how Spring Boot helps you build Spring-based applications quickly and easily, and the inner workings of Spring Boot using easy-to-follow ...
spring-build-src-3.2.4.RELEASE spring-context-3.2.4.RELEASE spring-context-support-3.2.4.RELEASE spring-core-3.2.4.RELEASE spring-expression-3.2.4.RELEASE spring-instrument-3.2.4.RELEASE spring-...
Spring的4.0的包 新手总是找不到下载的地方 每年下载地址也得变一变 所以上传上来给大家
spring-framework-3.2.0.BUILD-SNAPSHOT-dist.zip~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Build mission-critical ...3. Accessing Data with Spring 4. Understanding WebSocket 5. Securing Your Applications 6. Building a Single-Page Spring Application 7. Integrating with Other Web Frameworks
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 ...
Spring Boot Reference Guide 1.3.0.BUILD中文教程。
Build By Spring-Framework-4.3.18.RELEASE spring-cglib-repack-3.2.6.jar 文件大小:313502 字节 修改时间:2018年8月26日 09:12:09 MD5 :1F3A42309EC16632954291B584778432 SHA1 :7A9601D36541798180C2AFC4DA...
Take advantage of all the features of Spring 5.0 with third party tools to build a robust back end Secure Spring based web application using Spring Security framework with LDAP and OAuth protocol ...