下载编译spring-framework源码并导入STS中
2014-12-31 17:16
253 查看
一、准备工作
1. 下载安装STS(Spring Tool Suite),下载地址: http://spring.io/tools
STS是基于eclipse开发环境的,客制化用来开发Spring应用程序, 建议使用
2.下载安装gradle, 下载地址: http://www.gradle.org/downloads
Spring framework采用Gradle进行项目管理, 需要使用它进行项目构建
下载解压后, 配置环境变量:
新建GRADLE_HOME -> 值为 D:\Coding\gradle-2.2.1
Path中新增 -> ;%GRADLE_HOME%\bin;
3.下载安装jdk8, 下载地址: http://www.oracle.com/technetwork/java/javase/downloads/index.html
spring-framework使用了许多jdk8的特性,最好使用jdk8作为编译环境,否则会出现一些错误.
4.下载spring-framework源码(https://github.com/spring-projects/spring-framework)
Github下载: git clone git@github.com:spring-projects/spring-framework.git
Window直接下载: https://github.com/spring-projects/spring-framework/archive/master.zip
二、编译spring源码并导入STS中
1.切换到源码目录,执行命令: gradlew eclipse -x :eclipse
D:\Coding\sts-bundle\Github\spring-framework-master>gradlew eclipse -x :eclipse
此时会下载很多spring源码的依赖, 漫长的等待...
执行完以上步骤后, 再点击一次目录中的import-into-eclipse.bat文件, 点击后也会下载一些依赖...
做完以上步骤后, 进入项目目录, 会发现多了几个文件, 如.settings, .classpath, .project文件
2. 将编译后的项目导入sts中
Import -> Existing Projects into Workspace -> 选择父目录(spring-framework-master), 确定即可; 如果有错, 检查一下jdk是不是1.8.x版本的, 如果不是, 在preferences中, 设置JREs为jdk1.8
=====================================================================================
常见错误及解决方案:
1. cmd窗口下载时经常会卡住不动, 可以用ctrl + c强制结束, 再次执行命令, 此时可以继续下载
2. 报Execution failed for task':spring-core:compile Java错误, 多是因为没有安装jdk8, 导致许多类编译不过
3. 报Unrecognized VM option ‘MaxMetaspaceSize=1024m’
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.错误, 开始时, 也遇到过, 后将gradlew.bat文件中的下面两行注释(前面加两个冒号)掉, 错误就没了
参考文章:
http://blog.csdn.net/buyaore_wo/article/details/8977746 http://www.cnblogs.com/springsource/archive/2012/12/14/2818575.html https://github.com/spring-projects/spring-framework
1. 下载安装STS(Spring Tool Suite),下载地址: http://spring.io/tools
STS是基于eclipse开发环境的,客制化用来开发Spring应用程序, 建议使用
2.下载安装gradle, 下载地址: http://www.gradle.org/downloads
Spring framework采用Gradle进行项目管理, 需要使用它进行项目构建
下载解压后, 配置环境变量:
新建GRADLE_HOME -> 值为 D:\Coding\gradle-2.2.1
Path中新增 -> ;%GRADLE_HOME%\bin;
3.下载安装jdk8, 下载地址: http://www.oracle.com/technetwork/java/javase/downloads/index.html
spring-framework使用了许多jdk8的特性,最好使用jdk8作为编译环境,否则会出现一些错误.
4.下载spring-framework源码(https://github.com/spring-projects/spring-framework)
Github下载: git clone git@github.com:spring-projects/spring-framework.git
Window直接下载: https://github.com/spring-projects/spring-framework/archive/master.zip
二、编译spring源码并导入STS中
1.切换到源码目录,执行命令: gradlew eclipse -x :eclipse
D:\Coding\sts-bundle\Github\spring-framework-master>gradlew eclipse -x :eclipse
此时会下载很多spring源码的依赖, 漫长的等待...
D:\Coding\sts-bundle\Github\spring-framework-master>gradlew eclipse -x :eclipse :buildSrc:compileJava UP-TO-DATE :buildSrc:compileGroovy :buildSrc:processResources UP-TO-DATE :buildSrc:classes :buildSrc:jar :buildSrc:assemble :buildSrc:compileTestJava UP-TO-DATE :buildSrc:compileTestGroovy UP-TO-DATE :buildSrc:processTestResources UP-TO-DATE :buildSrc:testClasses UP-TO-DATE :buildSrc:test UP-TO-DATE :buildSrc:check UP-TO-DATE :buildSrc:build :spring-aop:eclipseClasspath :spring-aop:eclipseJdtPrepare :spring-aop:eclipseJdt :spring-aop:eclipseProject :spring-aop:eclipseSettings :spring-aop:eclipseWstComponent :spring-aop:eclipse :spring-aspects:eclipseClasspath :spring-aspects:eclipseJdtPrepare :spring-aspects:eclipseJdt :spring-aspects:eclipseProject :spring-aspects:eclipseSettings :spring-aspects:eclipseWstComponent :spring-aspects:eclipse :spring-beans:eclipseClasspath :spring-beans:eclipseJdtPrepare :spring-beans:eclipseJdt :spring-beans:eclipseProject :spring-beans:eclipseSettings :spring-beans:eclipseWstComponent :spring-beans:eclipse :spring-beans-groovy:eclipseClasspath :spring-beans-groovy:eclipseJdtPrepare :spring-beans-groovy:eclipseJdt :spring-beans-groovy:eclipseProject :spring-beans-groovy:eclipseSettings :spring-beans-groovy:eclipseWstComponent :spring-beans-groovy:eclipse :spring-build-src:eclipseClasspath :spring-build-src:eclipseJdtPrepare :spring-build-src:eclipseJdt :spring-build-src:eclipseProject :spring-build-src:eclipseSettings :spring-build-src:eclipseWstComponent :spring-build-src:eclipse :spring-context:eclipseClasspath :spring-context:eclipseJdtPrepare :spring-context:eclipseJdt :spring-context:eclipseProject :spring-context:eclipseSettings :spring-context:eclipseWstComponent :spring-context:eclipse :spring-context-support:eclipseClasspath :spring-context-support:eclipseJdtPrepare :spring-context-support:eclipseJdt :spring-context-support:eclipseProject :spring-context-support:eclipseSettings :spring-context-support:eclipseWstComponent :spring-context-support:eclipse :spring-core:eclipseClasspath :spring-core:eclipseJdtPrepare :spring-core:eclipseJdt :spring-core:eclipseProject :spring-core:eclipseSettings :spring-core:eclipseWstComponent :spring-core:eclipse :spring-expression:eclipseClasspath :spring-expression:eclipseJdtPrepare :spring-expression:eclipseJdt :spring-expression:eclipseProject :spring-expression:eclipseSettings :spring-expression:eclipseWstComponent :spring-expression:eclipse :spring-framework-bom:eclipseClasspath :spring-framework-bom:eclipseJdtPrepare :spring-framework-bom:eclipseJdt :spring-framework-bom:eclipseProject :spring-framework-bom:eclipseSettings :spring-framework-bom:eclipseWstComponent :spring-framework-bom:eclipse :spring-instrument:eclipseClasspath :spring-instrument:eclipseJdtPrepare :spring-instrument:eclipseJdt :spring-instrument:eclipseProject :spring-instrument:eclipseSettings :spring-instrument:eclipseWstComponent :spring-instrument:eclipse :spring-instrument-tomcat:eclipseClasspath :spring-instrument-tomcat:eclipseJdtPrepare :spring-instrument-tomcat:eclipseJdt :spring-instrument-tomcat:eclipseProject :spring-instrument-tomcat:eclipseSettings :spring-instrument-tomcat:eclipseWstComponent :spring-instrument-tomcat:eclipse :spring-jdbc:eclipseClasspath :spring-jdbc:eclipseJdtPrepare :spring-jdbc:eclipseJdt :spring-jdbc:eclipseProject :spring-jdbc:eclipseSettings :spring-jdbc:eclipseWstComponent :spring-jdbc:eclipse :spring-jms:eclipseClasspath :spring-jms:eclipseJdtPrepare :spring-jms:eclipseJdt :spring-jms:eclipseProject :spring-jms:eclipseSettings :spring-jms:eclipseWstComponent :spring-jms:eclipse :spring-messaging:eclipseClasspath :spring-messaging:eclipseJdtPrepare :spring-messaging:eclipseJdt :spring-messaging:eclipseProject :spring-messaging:eclipseSettings :spring-messaging:eclipseWstComponent :spring-messaging:eclipse :spring-orm:eclipseClasspath :spring-orm:eclipseJdtPrepare :spring-orm:eclipseJdt :spring-orm:eclipseProject :spring-orm:eclipseSettings :spring-orm:eclipseWstComponent :spring-orm:eclipse :spring-orm-hibernate4:eclipseClasspath :spring-orm-hibernate4:eclipseJdtPrepare :spring-orm-hibernate4:eclipseJdt :spring-orm-hibernate4:eclipseProject :spring-orm-hibernate4:eclipseSettings :spring-orm-hibernate4:eclipseWstComponent :spring-orm-hibernate4:eclipse :spring-oxm:eclipseClasspath :spring-oxm:eclipseJdtPrepare :spring-oxm:eclipseJdt :spring-oxm:eclipseProject :spring-oxm:eclipseSettings :spring-oxm:eclipseWstComponent :spring-oxm:eclipse :spring-test:eclipseClasspath :spring-test:eclipseJdtPrepare :spring-test:eclipseJdt :spring-test:eclipseProject :spring-test:eclipseSettings :spring-test:eclipseWstComponent :spring-test:eclipse :spring-tx:eclipseClasspath :spring-tx:eclipseJdtPrepare :spring-tx:eclipseJdt :spring-tx:eclipseProject :spring-tx:eclipseSettings :spring-tx:eclipseWstComponent :spring-tx:eclipse :spring-web:eclipseClasspath :spring-web:eclipseJdtPrepare :spring-web:eclipseJdt :spring-web:eclipseProject :spring-web:eclipseSettings :spring-web:eclipseWstComponent :spring-web:eclipse :spring-webmvc:eclipseClasspath :spring-webmvc:eclipseJdtPrepare :spring-webmvc:eclipseJdt :spring-webmvc:eclipseProject :spring-webmvc:eclipseSettings :spring-webmvc:eclipseWstComponent :spring-webmvc:eclipse :spring-webmvc-portlet:eclipseClasspath :spring-webmvc-portlet:eclipseJdtPrepare :spring-webmvc-portlet:eclipseJdt :spring-webmvc-portlet:eclipseProject :spring-webmvc-portlet:eclipseSettings :spring-webmvc-portlet:eclipseWstComponent :spring-webmvc-portlet:eclipse :spring-webmvc-tiles2:eclipseClasspath :spring-webmvc-tiles2:eclipseJdtPrepare :spring-webmvc-tiles2:eclipseJdt :spring-webmvc-tiles2:eclipseProject :spring-webmvc-tiles2:eclipseSettings :spring-webmvc-tiles2:eclipseWstComponent :spring-webmvc-tiles2:eclipse :spring-websocket:eclipseClasspath Download https://repo.spring.io/libs-release/io/netty/netty-all/4.0.20.Final/netty-all-4.0.20.Final.jar Download https://repo.spring.io/libs-release/javax/websocket/javax.websocket-api/1.0/javax.websocket-api-1.0-sources.jar Download https://repo.spring.io/libs-release/org/apache/tomcat/tomcat-websocket/8.0.15/tomcat-websocket-8.0.15-sources.jar Download https://repo.spring.io/libs-release/org/glassfish/tyrus/tyrus-spi/1.3.5/tyrus-spi-1.3.5-sources.jar Download https://repo.spring.io/libs-release/org/glassfish/tyrus/tyrus-core/1.3.5/tyrus-core-1.3.5-sources.jar Download https://repo.spring.io/libs-release/org/glassfish/tyrus/tyrus-server/1.3.5/tyrus-server-1.3.5-sources.jar Download https://repo.spring.io/libs-release/org/glassfish/tyrus/tyrus-container-servlet/1.3.5/tyrus-container-servlet-1.3.5-sources.jar Download https://repo.spring.io/libs-release/org/eclipse/jetty/jetty-client/9.2.4.v20141103/jetty-client-9.2.4.v20141103-sources.jar Download https://repo.spring.io/libs-release/io/undertow/undertow-core/1.0.17.Final/undertow-core-1.0.17.Final-sources.jar Download https://repo.spring.io/libs-release/io/undertow/undertow-servlet/1.0.17.Final/undertow-servlet-1.0.17.Final-sources.jar Download https://repo.spring.io/libs-release/io/undertow/undertow-websockets-jsr/1.0.17.Final/undertow-websockets-jsr-1.0.17.Final-sources.jar Download https://repo.spring.io/libs-release/org/apache/tomcat/tomcat-juli/8.0.15/tomcat-juli-8.0.15-sources.jar Download https://repo.spring.io/libs-release/org/apache/tomcat/tomcat-util/8.0.15/tomcat-util-8.0.15-sources.jar Download https://repo.spring.io/libs-release/org/glassfish/tyrus/tyrus-client/1.3.5/tyrus-client-1.3.5-sources.jar Download https://repo.spring.io/libs-release/org/glassfish/grizzly/grizzly-framework/2.3.7/grizzly-framework-2.3.7-sources.jar Download https://repo.spring.io/libs-release/org/glassfish/grizzly/grizzly-http/2.3.7/grizzly-http-2.3.7-sources.jar Download https://repo.spring.io/libs-release/org/glassfish/grizzly/grizzly-http-server/2.3.7/grizzly-http-server-2.3.7-sources.jar Download https://repo.spring.io/libs-release/org/glassfish/tyrus/tyrus-container-grizzly-client/1.3.5/tyrus-container-grizzly-client-1.3.5-sources.jar Download https://repo.spring.io/libs-release/org/jboss/logging/jboss-logging/3.1.4.GA/jboss-logging-3.1.4.GA-sources.jar Download https://repo.spring.io/libs-release/org/jboss/xnio/xnio-api/3.2.0.Final/xnio-api-3.2.0.Final-sources.jar Download https://repo.spring.io/libs-release/org/jboss/xnio/xnio-nio/3.2.0.Final/xnio-nio-3.2.0.Final-sources.jar Download https://repo.spring.io/libs-release/org/jboss/spec/javax/servlet/jboss-servlet-api_3.1_spec/1.0.0.Final/jboss-servlet-api_3.1_spec-1.0.0.Final-sources.jar Download https://repo.spring.io/libs-release/org/jboss/spec/javax/annotation/jboss-annotations-api_1.2_spec/1.0.0.Final/jboss-annotations-api_1.2_spec-1.0.0.Final-sources.jar Download https://repo.spring.io/libs-release/io/netty/netty-all/4.0.20.Final/netty-all-4.0.20.Final-sources.jar :spring-websocket:eclipseJdtPrepare :spring-websocket:eclipseJdt :spring-websocket:eclipseProject :spring-websocket:eclipseSettings :spring-websocket:eclipseWstComponent :spring-websocket:eclipse BUILD SUCCESSFUL Total time: 2 mins 11.403 secs D:\Coding\sts-bundle\Github\spring-framework-master>
执行完以上步骤后, 再点击一次目录中的import-into-eclipse.bat文件, 点击后也会下载一些依赖...
做完以上步骤后, 进入项目目录, 会发现多了几个文件, 如.settings, .classpath, .project文件
2. 将编译后的项目导入sts中
Import -> Existing Projects into Workspace -> 选择父目录(spring-framework-master), 确定即可; 如果有错, 检查一下jdk是不是1.8.x版本的, 如果不是, 在preferences中, 设置JREs为jdk1.8
=====================================================================================
常见错误及解决方案:
1. cmd窗口下载时经常会卡住不动, 可以用ctrl + c强制结束, 再次执行命令, 此时可以继续下载
2. 报Execution failed for task':spring-core:compile Java错误, 多是因为没有安装jdk8, 导致许多类编译不过
3. 报Unrecognized VM option ‘MaxMetaspaceSize=1024m’
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.错误, 开始时, 也遇到过, 后将gradlew.bat文件中的下面两行注释(前面加两个冒号)掉, 错误就没了
::set GRADLE_OPTS=-XX:MaxMetaspaceSize=1024m -Xmx1024m -XX:MaxHeapSize=256m %GRADLE_OPTS% ::set DEFAULT_JVM_OPTS=后来又遇到第二个错误, 没办法就安装了jdk8, 把注释掉的两行代码又给放开了, 也就没有了这个错误.
参考文章:
http://blog.csdn.net/buyaore_wo/article/details/8977746 http://www.cnblogs.com/springsource/archive/2012/12/14/2818575.html https://github.com/spring-projects/spring-framework
相关文章推荐
- spring-framework 4.x 源码下载并导入eclipse
- spring-framework3.2源码下载导入eclipse
- 用SVN下载编译Spring3.2.4源码导入eclipse
- Spring-framework 源码下载导入Eclipse
- Spring3.2.0源码下载并编译,导入Idea
- Spring源码研究--下载-编译-导入eclipse-验证
- Spring源码研究--下载-编译-导入eclipse-验证
- Spring源码研究--下载-编译-导入eclipse-验证
- Spring4源码下载编译并导入eclipse
- Spring -- framework 各版本源码下载地址
- spring3.1.x源码编译并导入eclipse
- Hadoop 源码下载,编译,install,导入eclipse
- 用SVN下载编译Spring v4.1.6.RELEASE源码导入eclipse
- spring源码剖析(一)下载spring3.2源代码,并编译源代码
- Git下载Spring源码 Gradle编译Spring源码为Eclipse工程文件
- Eclipse导入spring-framework-3.2.*源码
- spring3.1.x源码编译并导入eclipse
- Spring源码学习一_下载Spring项目源码并编译为Eclipse
- Spring 3.2.4源码编译导入eclipse