Spring-5.0.x source code download and local environment construction

1. Spring source code download

Download Spring source code from github

Download address: https://github.com/spring-projects/spring-framework

After accessing the address, open the Spring code page and find the version you want to download, such as 5.0.x, as shown in the figure below:

Download method one: git clone

After switching versions, click the code button on the right, copy the address, and execute the git clone command locally.

Download method two: Directly download the compressed package 

Or click on the Code button and find the download code compressed package, as shown below:

 The downloaded code directory structure is as follows:

2. Use IntelliJ IDEA to import code

Directly use the operation below to open the code, File—>Open... to open the root directory of the code

 

After opening, IDEA will automatically load the project. If there is no Gradle, it will automatically install the plug-in. Wait for a while.

Since so far, we have just opened the code and waited for automatic compilation by IDEA, the following error will occur during the compilation process:

Could not GET ‘https://repo.spring.io/plugins-release/org/springframework/build/gradle/xxx

The error message on the console is as follows: 

It turns out that Spring requires permission authentication to access the repo.spring.io warehouse after 5.X , but I don’t have the account and password of the Spring warehouse. How can I pull the jar? Here we can use Alibaba Cloud's image instead of Spring's official website image. Just modify the image in the build.gradle file in the project .

Open the build.gradle file under the project , as shown in the figure below:

 Replace it with the following:

//maven私服。此处设置为ali的旧库,地址是url
maven{ url "http://maven.aliyun.com/nexus/content/groups/public" }
//阿里云新库
maven { url "https://maven.aliyun.com/repository/central" }
maven { url "https://maven.aliyun.com/repository/google" }
maven { url "https://maven.aliyun.com/repository/gradle-plugin" }
maven { url "https://maven.aliyun.com/repository/jcenter" }
maven { url "https://maven.aliyun.com/repository/spring" }
maven { url "https://maven.aliyun.com/repository/spring-plugin" }
maven { url "https://maven.aliyun.com/repository/public" }
maven { url "https://maven.aliyun.com/repository/releases" }
maven { url "https://maven.aliyun.com/repository/snapshots" }
maven { url "https://maven.aliyun.com/repository/grails-core" }
maven { url "https://maven.aliyun.com/repository/mapr-public" }
maven { url "https://maven.aliyun.com/repository/apache-snapshots" }

After the replacement is completed, click Compile again. At this time, you can download the dependent jar package.

This process may be slow, please be patient. . .

After the download is completed and the compilation is completed, you can freely check the Spring source code. .

Supongo que te gusta

Origin blog.csdn.net/java_faep/article/details/132554943
Recomendado
Clasificación