How to compile spring-framework 5.x source code

Environment jdk1.8 or jdk11 spring-framework source code comes with gradle execution will automatically configure for you

Official website address

https://spring.io/projects/spring-framework

1. Open the spring official github https://github.com/spring-projects/spring-framework/tree/v5.2.0.RELEASE to download version 5.2 of the spring source code and decompress it

2. Modify the directory build.gradle file to join the Alibaba Cloud remote warehouse

repositories {
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public' }
        maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'} 
    }

3. Pre-compilation spring-oxmand./gradlew :spring-oxm:compileTestJava

   进入目录windows执行 gradlew :spring-oxm:compileTestJava  如图 下载完成

3. Import IntelliJ (File -> New -> Existing Source Project -> Navigate to Directory -> Select build.gradle)

 

   Then import idea. If it is an old version of ide, select gradle, such as the 2019 version. If it is a new version, open it directly, such as the 2020 version.

Wait for the download to complete

4. When prompted, exclude the spring-aspectsmodule (or after importing via "File" -> "Project Structure" -> "Module")

 Right click on the spring-aspects project

Select load/upload moduls...

Click upload

 

That's ok

5. Take away the code

  This completes the compilation  

Problems encountered

If the reference package is not imported, it needs to be executed

gradlew -a:spring-core:test
gradlew -a:spring-oxm:test

Known issues

  1. spring-coreIt spring-oxmshould be pre-compiled due to repackaged dependencies. See *RepackJarthe tasks in the build and https://youtrack.jetbrains.com/issue/IDEA-160605 ).
  2. spring-aspectsUnable to compile due to a reference to an aspect type unknown to IntelliJ IDEA. For details, see https://youtrack.jetbrains.com/issue/IDEA-64446 . At the same time, the "spring aspect" can be excluded from the project to avoid compilation errors.
  3. Although JUnit tests are passed from the command line through Gradle, some tests may fail when run from IntelliJ IDEA. Solving this problem is in progress. If you are trying to run all JUnit tests from IntelliJ IDEA, you may need to set the following VM options to avoid out of memory errors: -XX: MaxPermSize = 2048m -Xmx2048m -XX: MaxHeapSize = 2048m
  4. If you call "rebuild project" in the IDE, you must generate spring-oxmsome test resources for the module again ( ./gradlew :spring-oxm:compileTestJava)

 

 

Guess you like

Origin blog.csdn.net/qq_39313596/article/details/115331835