spring framework源碼下載並導入eclipse

最近在看Spring源碼,轉載篇文章,將Spring源碼導入eClipse中的操作。

原文地址:http://blog.csdn.net/buyaore_wo?viewmode=contents

一. 準備工作

1.下載安裝sts(springsource推薦使用), 畢竟人家的框架用他自家的ide是最好的,當然sts也是基本eclipse的, 下載地址: http://www.springsource.org/downloads/sts-ggts

2.下載安裝gradle, spring 源碼構建加入了gradle支持. gradle下載: http://www.gradle.org/downloads ,下載後設置環境變量: GRADLE_HOME = gradle主目錄 , 並在path中加入;%GRADLE_HOME%\bin;

3.下載安裝github, spring源碼託管到了github : http://windows.github.com/ (windows) ,當然您壓需要註冊github賬號 , spring github託管地址: https://github.com/SpringSource/spring-framework

二.將springframework導入eclipse(sts)

   1.生成eclipse配置 .

進入spring源碼目錄: 結構如下:

可以看到spring爲我們提供了導入eclipse的腳本,執行腳本即可.

不過經過我的實驗spring提供的腳本執行到一半就出問題了不知道是什麼原因. 我們自己用gradle命令來替代它提供給我們的腳本:

進入spring目錄, 執行命令: gradle eclipse -x :eclipse

第一次執行會花比較長的時間,gradle會去下載許多依賴庫, 執行報的結果如下 , 因爲我之前已經執行過了花的時間不多

F:\GitHub\spring-framework>gradle eclipse -x :eclipse
:buildSrc:clean
:buildSrc:compileJava UP-TO-DATE
:buildSrc:compileGroovy
:buildSrc:processResources
: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
:buildSrc:check
:buildSrc:build
The ConfigurationContainer.add() method has been deprecated and is scheduled to be removed
 in Gradle 2.0. Please use the create() method instead.
The groovy configuration has been deprecated and is scheduled to be removed in Gradle 2.0.
 Typically, usages of 'groovy' can simply be replaced with 'compile'. In some cases, it ma
y be necessary to additionally configure the 'groovyClasspath' property of GroovyCompile a
nd Groovydoc tasks.
The TaskContainer.add() method has been deprecated and is scheduled to be removed in Gradl
e 2.0. Please use the create() method instead.
: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-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
Download http://repo.springsource.org/libs-release/commons-logging/commons-logging/1.1.3/c
ommons-logging-1.1.3.pom
Download http://repo.springsource.org/libs-release/commons-logging/commons-logging/1.1.3/c
ommons-logging-1.1.3.jar
: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-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-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-struts:eclipseClasspath
:spring-struts:eclipseJdtPrepare
:spring-struts:eclipseJdt
:spring-struts:eclipseProject
:spring-struts:eclipseSettings
:spring-struts:eclipseWstComponent
:spring-struts:eclipse
:spring-test:eclipseClasspath
:spring-test:eclipseJdtPrepare
:spring-test:eclipseJdt
:spring-test:eclipseProject
:spring-test:eclipseSettings
:spring-test:eclipseWstComponent
:spring-test:eclipse
:spring-test-mvc:eclipseClasspath
:spring-test-mvc:eclipseJdtPrepare
:spring-test-mvc:eclipseJdt
:spring-test-mvc:eclipseProject
:spring-test-mvc:eclipseSettings
:spring-test-mvc:eclipseWstComponent
:spring-test-mvc: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-tiles3:eclipseClasspath
:spring-webmvc-tiles3:eclipseJdtPrepare
:spring-webmvc-tiles3:eclipseJdt
:spring-webmvc-tiles3:eclipseProject
:spring-webmvc-tiles3:eclipseSettings
:spring-webmvc-tiles3:eclipseWstComponent
:spring-webmvc-tiles3:eclipse

BUILD SUCCESSFUL

Total time: 1 mins 57.462 secs

執行完畢的進入到每個子目錄下可以看到多了幾個文件或目錄, 就是設置eclipse項目及classpath的一配置如下:

 .settingsh文件夾及.classpath和.project就是剛纔生成的配置

2.導入eclipse

eclipse : import - >

       

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章