Notes on learning Spring source code -- it is not difficult to download and compile Spring source code

Prerequisite preparation:




Download the source code:

Visit the official website of, then go to Projects, click the kitten in the upper right corner, and download the Spring source code from Github!

Choose a RELEASE version, I choose the RELEASE version of 5.2, choose Download ZIP, no need for Clone!!!

After downloading, directly decompress to the specified directory!

Simply follow the operation:

Official guidance is the most reliable!

1. Precompile `spring-oxm` with `./gradlew :spring-oxm:compileTestJava`
2. Import into IntelliJ (File -> New -> Project from Existing Sources -> Navigate to directory -> Select build.gradle)
3. When prompted exclude the `spring-aspects` module (or after the import via File-> Project Structure -> Modules)
4. Code away

1, Precompile:

Before precompiling, you'd better configure the Alibaba cloud images of Maven and Gradle to improve the download speed!

Add the following to maven's settings.xml:

      <name>aliyun maven</name>
	  <mirrorOf>aliyun maven</mirrorOf>

Edit the build.gradle file again:

(The second element)
repositories {
		maven{ url '' }
		maven{ url '' }
(About line 300)
repositories {
			maven{ url '' }
			maven{ url '' }
			maven { url "" }

After configuration, go to the root directory of Spring source code through the command line and execute the following instructions:

gradlew :spring-oxm:compileTestJava(windows)

./gradlew :spring-oxm:compileTestJava(mac)

If there is no error in the above configuration, it will prompt build success:

2, Import source code into IDEA

New Project, or Import Project

Then select the source root directory, and directly OK!

Next, select according to the following figure, and click Next!

Next just wait!!!

If it fails to download a jar package, click the pop-up connection on the console, the browser will download it automatically, and then manually add the jar package to the

. gradle\caches\modules-2\files-2.1.

Like I'm here

Caused by: org.gradle.api.resources.ResourceException: Could not get resource ''

Click the following link, the jar package will be downloaded automatically, and then the downloaded jar package will be placed in the specified path,

Then refresh, if there are similar problems, follow the above method!!!

3, Exclude the spring aspects module:

Right click the module and click load/unload:

Click OK and build project!

The spring aspects module will turn orange, and the project will not report errors!

Then, you can create new modules to call each other!!!

Of course, I compiled the process is relatively smooth, if you encounter some other errors, you can baidu below!!!

Published 10 original articles, won praise 35, visited 10000+
Private letter follow

Keywords: Maven Spring Gradle nexus

Added by maniac1aw on Sat, 14 Mar 2020 03:43:45 +0200