Springソースコンパイル

2688 ワード

http://www.flyoung.me/2013/08/02/springcodecompile/
前言
Springのソースは前に読んだことがあります.主にIOCの部分を読んでいます.パソコンを変えたことに加えて、他の部分も見たいと思い、また来たことがある.SpringソースはGitHubに移転しました.
準備工作
GitとJDK 1.7+が必要です.最新のspring-frame ewarkはgradleでコンパイルしたので、gradleをダウンロードする必要があります.
ダウンロード
私はSpring 3.2.xバージョンをダウンロードしました.
git clone git://github.com/SpringSource/spring-framework.git
ソースコンパイル
1、gradlew.batのjvmメモリ設定に関するパラメータを修正します.
元の設定:
set GRADLE_OPTS=-XX:MaxPermSize=1024m -Xmx1024m -XX:MaxHeapSize=256m %GRADLE_OPTS%
現在設定:
set GRADLE_OPTS=-XX:MaxPermSize=512m -Xmx512m -XX:MaxHeapSize=256m %GRADLE_OPTS%
さもないと次のようなエラーがあります.
Error occurred during initialization of VM

Could not reserve enough space for object heap

Could not create the Java virtual machine
2、cmdでspring-frame ewarkディレクトリに入り、gradlew.bat build -x testを実行して、すべてのテストをスキップします.テストはいつも失敗するので、spring-oxmのテストケースに問題があり、コンパイルが失敗しました.
3、すべてのスプリング-jarsを地元のMaven cacheにインストールし、gradlew.bat installを実行します.
4、ソースコードをeclipseに導入する.
4.1、cmdウィンドウ実行コマンドgradlew.bat cleanEclipse :spring-oxm:compileTestJava eclipse -x :eclipse4.2、eclipse File>Import...>Existing Project into Workspaceによって、すべてのsprigFraameworkプロジェクトを導入する.
4.3、cmdウィンドウでgradlew.bat :eclipseを実行する.
4.4、eclipse File>Import...>Existing Projects into WorkspaceによってsprigFraamework親プロジェクトを導入する.
締め括りをつける
全過程は苦労を重ねたと言えます.成果を見てみましょう
 
 
========https git
https://github.com/spring-projects/spring-framework
Buiding from source
The Spring Frame ebook uses a Graadle-based build system.In the instructions below,./gradlew is invoked from the source tre and serves as a cross-plot form,self-containd boot the strame form.
prerequisites
Git and OpenJDK 8 early access build 100 or later
Be sure that your JAVA_HOME environment variable points to the jdk1.8.0 folder extraced from the JDK download.
check out sourcesgit clone git://github.com/SpringSource/spring-framework.gitimport sources into your IDE
Run ./import-into-eclipse.sh or read import-into-idea.md as apprate.
Note:Per the prerequisites above,ensure that you have JDK 8 configred properly in your IDE.
install all spring-*jars into your local Maven cache./gradlew installcomple and test、build all jars、distribution zps and docs./gradlew build…and discover more command with ./gradlew tasks.See also the Grade build and release FAQ.