Prepare the installation package and environment

Download the source code of Spring – Framework

Spring-framework source repository is maintained on Github platform, readers can search for how to clone github source repository to Gitee platform.

The author has cloned a version, lazy readers can directly pull: gitee.com/woodwhales/…

Warning! : Directory for storing spring- Framework source code. Do not contain special characters, Chinese characters, or Spaces.

Use git command or source tree tool to switch the tag of the code branch to 5.2.9.RELEASE

After the switch is successful, version 5.2.9 is displayed in the gradle.properties file in the root directory of the project:

Gradle download and install

Move on to my post on maven and Gradle build tools installation and IDE configuration

Gadle compiles and configures

Step 1: build. Gradle

Go to the build.gradle file in the project root and add the following configuration at approximately 280 lines:

maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }
maven { url 'https://maven.aliyun.com/nexus/content/repositories/jcenter'}
Copy the code

Step 2: Settings. gradle

Go to settings.gradle in the project root and add the following to the pluginManagement configuration on line 2:

maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
maven { url "https://maven.aliyun.com/repository/public" }
Copy the code

Step 3: gradle.properties

Modify the gradle.properties file and set org.gradle.jvmargs to -xmx2048m

version=5.2.9. RELEASE
The main reason for setting this parameter is that compiling the downloaded package takes up a lot of memory and may run out of memory
org.gradle.jvmargs=-Xmx2048M
## Enable Gradle cache
org.gradle.caching=true
## Enable parallel compilation
org.gradle.parallel=true
Enable the new incubation mode
org.gradle.configureondemand=true
By enabling the daemon, the next time a build is made, it will connect to the daemon instead of forking a gradle build
org.gradle.daemon=true
Copy the code

IDEA environment compilation

In the project root directory, right-click: Git Bash Here to open the Git Bash window.

The author has installed git tool. Readers can also open Windows Terminal program or CMD program and run the following command:

gradlew :spring-oxm:compileTestJava

Run the following command:

./gradlew :spring-oxm:compileTestJava
Copy the code

Command when the following command output is displayed:

Downloading https://services.gradle.org/distributions/gradle-6.6.1-bin.zip
..
Copy the code

Press CTRL + C to stop the download task and type the gradle package address in the browser. The browser will automatically download the Gradle package.

Good will download gradle bag: % GRADLE_USER_HOME % \ wrapper \ dists \ gradle 6.6.1 – bin \ du4tvj86lhti6iga1v8h7pckb folder directory. In this folder are: the above download task created, go to this directory, will be inside the unfinished file deletion.

GRADLE_USER_HOME is configured in a system environment variable. The value configured by the author is the root directory of maven’s local repository.

Run the./gradlew :spring-oxm:compileTestJavaa command again.

After successful compilation, import the project using IDEA.

Common mistakes

File directory problem

If the reader follows the above steps strictly, compilation failures will generally not occur. If the following error occurs, there is probably a problem with the spring source directory.

I performed the same operation on two computers, one successfully, the other failed. For a long time, I suspected that there was something wrong with the computer operating system that failed to compile, so I reinstalled the system, but the result was still failed to compile. After careful consideration, I seriously suspect that the source directory is the problem, of course, so THE author in the above “Download spring- Framework source code” section highlighted the warning.

AnnotationCacheAspect could not find the symbol

This is because AnnotationCacheAspect.aj is nota Java file that needs to be processed by a separate AspectJ, and you can follow these steps to resolve the problem

  • Download aspectj, corresponding links: www.eclipse.org/downloads/d…
  • Install aspectj

Run the java-jar aspectj-1.9.5.jar command to install Aspectj-1.9.5.jar to a local directory. The Aspectj Weaver plug-in is installed in IDEA.

See the detail: www.cnblogs.com/qubo520/p/1…

The resources

www.cnblogs.com/qubo520/p/1…

www.cnblogs.com/liuyangfirs…

Gitee.com/zhong96/spr…

Gitee.com/zhong96/spr…

Personal blog: Woodwhale’s Blog

Blogland: The blog of the wooden whale