1. 环境准备
- 安装:jdk1.8
- 安装:gradle
2. 下载or克隆源码
- 地址:https://github.com/spring-projects/spring-framework
- 克隆:git clone https://github.com/spring-projects/spring-framework.git
3. 编译(可以直接跳过直接导入idea)
- 预编译spring-oxm: ./gradlew :spring-oxm:compileTestJava
- 编译整个项目:./gradlew build -x test (忽略test)
4. 导入idea
-
导入效果
-
gradle配置
-
构建源码
- 新建测试module
5. 附录
- gradle/docs.gradle (windows环境)
task schemaZip(type: Zip) {
group = "Distribution"
baseName = "spring-framework"
classifier = "schema"
description = "Builds -${classifier} archive containing all " +
"XSDs for deployment at http://springframework.org/schema."
duplicatesStrategy 'exclude'
moduleProjects.each { subproject ->
def Properties schemas = new Properties();
subproject.sourceSets.main.resources.find {
it.path.endsWith("META-INF\\spring.schemas")
}?.withInputStream { schemas.load(it) }
for (def key : schemas.keySet()) {
def shortName = key.replaceAll(/http.*schema.(.*).spring-.*/, '$1')
assert shortName != key
File xsdFile = subproject.sourceSets.main.resources.find {
it.path.endsWith(schemas.get(key).replaceAll('\\/','\\\\'))
}
assert xsdFile != null
into (shortName) {
from xsdFile.path
}
}
}
}
- IDEA导入参考
import-into-idea.md