Code environment ready
- JDK 8
- Gradle
- Compilation Tools (Common IDEA)
- Source Address
Download to a local source
$ git clone [email protected]:spring-projects/spring-framework.git
复制代码
Not recommended to download master
branch code, because some small problems have been fixed, so I downloaded the v2.3.0.M2
version of releases
the code.
Because I am also while reading, while taking notes, download the source code, write the demo
code and comments are on the inside, little friends can download the code I uploaded, pro-test can be run ~
Set Gradle path
There are two options:
- IDEA default selection tool (Recommend)
- Select the user's own download Gradle (my local brew by download)
The last set:
Download dependent and compiler
After importing the project, recognizes Gradle
the dependency will first download dependencies from a central repository.
After downloading dependent, compiled code, through a graphical interface, selecting the root path build
tasks.
Finally, compiled class
and other documents path in each module build
directory.
Spring source code analysis general process
- Introduce the concept
- View class integrated system
- Simple demo
- View source
- Process analysis
Encountered pit
Gradle project is not recognized
This problem is solved by version controll
the cloning code when opening a new project has been suggested
Could not resolve symbol "XXX"
# 还有右上角弹出的
Try resolve again
复制代码
I do not know what a start the import process error by querying the data and found that code clone
to a local post, by following these steps, the project will be able to properly identify and download the dependence:
- Click
IDEA
theFile -> Open
select itemsbuild.gradle
- Follow the prompts to set
Gradle
- Download dependent and compiler
gradle version and a version mismatch Idea
The local gradle
version is 5.4.1
$ gradle -v
Welcome to Gradle 5.4.1!
复制代码
IDEA
Version of the tool is 2018.2, check the information, there may be a higher version gradle
requires a new version IDEA
, so I went to download the new version of the tool.
(By the way Amway about the new version of the theme Purple Theme Dark )
Update IDEA
later, when building the project, the last step stuck, tips:
java.lang.AbstractMethodError: org.jetbrains.plugins.gradle.tooling.util.ModuleComponentIdentifierImpl.getModuleIdentifier()Lorg/gradle/api/artifacts/ModuleIdentifier;
复制代码
View information about gradle
the upgrade, there was jar
the version compatibility issues, then follow the prompts, change the compilation mode ( see picture above gradle selection method ), modification is completed, be able to build the project properly.
Reference material
1, solve the IDEA project after the import Gradle newspaper Could not resolve symbol "XXX" error
Reproduced in: https: //juejin.im/post/5d03821cf265da1bcf5dd908