1 Spring 5 source code download

First you need to upgrade your JDK to 1.8 or higher. As of Spring 3.0, Spring source code is hosted on GitHub, and the official website download link is no longer provided. I don’t want to repeat too much here, you can go to GitHub website to download, I used the download link github.com/spring-proj… After downloading, unzip the source package and you will see the file directory as shown below.

2 Based on Gradle source code construction skills

Since Spirng 5 onwards is compiled using Gradle, you need to install Gradle before building the source code. Download Gradle from gradle.org/releases. I am using Gradle 4.0, which is recommended by Spring 5. Download Gradle from gradle.org/next-steps/… After the download is complete, perform the following steps. The Following uses Windows as an example. The first step is to configure the environment variables, as shown below.

Step 2, add the environment variable “%GRADLE_HOME%\bin”, as shown below.

Step 3, check the environment, enter gradle -v command, get the result as shown below.


----------------------------------------------------------------------
Gradle 4.0 
----------------------------------------------------------------------

Build time:2017-06-14 15:11:08 UTC Revision: 316546a5fcb4e2dfe1d6aaUb73a4e09e8cecb5a5 Groovy2. 4. 11
Ant:Apache Ant THD version 1. 9.6 compiled on June 29 2015
JVM:1.8. 0 _131 (Oracle Corporation 25.131-b11)
OS:Windows 10 10. 0 amd64

Copy the code

Step 4 compile the source code, cut CMD to the spring-Framework-5.0.2. RELEASE directory and run gradlew.


Starting a Gradle Daemon (subeequent builds wi11 be faster)> Task :he1p We1come to Gradle 4.3.1. To run a build, run gradlew < Task >... To see a list of available tasks, run gradlew tasks To see a list of command-line options, Run gradlew -- help To see more detail about a task, run gradlew help --task <task> DUILD SUCCESSPUL in 8s 1 actionable task: 1 executedCopy the code

Step 5, convert to Eclipse project, execute import-into-eclipse.bat command, make sure the network is in good condition before build, press any key to continue:


----------------------------------------------------------------------
Spring Framework - Eclipse/STS project impart guide

This script will guide you through the process of importing the Spring
Framerork projects into Ec1ipse or the Spring Tool Suite STS) It is
recommended that you have a recent version of Eclipse or STS. As a bare
minimum you wi11 need Eclipse with full Java 8 support, the AspectJ
Development Tools (AJDT), and the Groovy Compiler.

If you need to download and install Eclipse or STS, please do that now
by visiting one of the following sites:

- Eclipse dommloads: http://dowload.eclipse.org/eclipse/dowloads
- STS dowmloads: http://spring.io/too1s/sts/a11
- STS nightly builds:http://dist.springsource.com/snapshot/STS/night1y-distributions.html
- ADJT: http://www.eclipse.org/ajdt/downloads/
- Groovy Eclipse: https://github.com/groovy/groovy-eclipse/wikiOtheryise. PRGSS enter and we '11 begin. Please press any key to continue... -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - STEP 1: Generate subproject Eclipse metadata The first step wil1 be to generate Eclipse project metadatafor each
of the spring-* subprojects. This happens via the built-in
"Gradle wrapper" script (./gradlew in this directory). If this is your
first time using the Gradle wrapper, this step may take a fewr minutes
while a Gradle distribution is downloaded for you.

Copy the code

The sixth step, wait for the successful construction (if errors occur during the process, most of them are caused by network interruption, generally retry can solve the problem), the following information will appear after the successful construction:


BUILD SUOCESSFUL in 6s
6 actionable tasks: 6 executed

----------------------------------------------------------------------
STEP 4: Import root project into Ec1ipse/STS

Follow the project inport steps listed in step 2 above to inport the 
root project.

Press. enter, when complete, and move on to the finalStep. Press any key to continue... -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- step5: Enable Git support for all projects

- In the Ec1ipse/STS Package Exp1orer, se1ect al1 spring* projects.
- Right-click to cpen the context menu and select Team > Share Project...
- In the Share Project dialog that appears, select Git and press Next
- Check "Use or create repository in parent folder of project"
- C1ick Finish

When complete, you' 11 have Git support enabled for all projects. You' re ready to code! Goodbye!

Copy the code

At this point, you are ready to import your project into Eclipse. The IDEA we recommend is also smart and directly compatible with Eclipse projects. Continue to look at the following steps. Step 7: Import IDEA. Open IntelliJ IDEA, click “Import Project”, select the spring-Framework-5.0.2. RELEASE folder in the interface that is displayed, click “OK”, and then click “Finish”, as shown in the following three figures.

Step 8: Wait for the build to complete, which takes about 10 minutes if the network is good. You should see the interface shown below.

Step 9. In IDEA, if you can find the ApplicationContext class, press Ctrl+Shift+Alt+U.

3 Pits in Gradle build process

If the project environment is never built successfully and the class diagram is not automatically generated, you must have stepped into a pit. First, click View→Tool Windows→Gradle, as shown in the following figure.

Second, click the Refresh button in the Gradle view, as shown below.

An error occurs as shown in the figure below.

(1) Close IDEA, open task manager, and terminate all processes related to Java. (2) Go to JAVA_HOME→jre→lib and rename tools.jar to tools.jar.bak. (3) Restart IDEA, click the refresh button again, and wait for the construction to complete.

This article is “Tom play structure” original, reproduced please indicate the source. Technology is to share, I share my happiness! If you have any suggestions can also leave a comment or private letter, your support is my motivation to adhere to the creation. Pay attention to “Tom bomb architecture” for more technical dry goods!

Original is not easy, adhere to very cool, see here, small partners remember to like, collect, look, one key three even add attention! If you feel the content is too dry, you can share and forward to a friend moist moist!