Spring 5 源码环境搭建(1)

文章目录

    • 1. 环境准备
    • 2. 下载or克隆源码
    • 3. 编译(可以直接跳过直接导入idea)
    • 4. 导入idea
    • 5. 附录

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

  • 导入效果
    Spring 5 源码环境搭建(1)_第1张图片

  • gradle配置
    Spring 5 源码环境搭建(1)_第2张图片

  • 构建源码

Spring 5 源码环境搭建(1)_第3张图片

  • 新建测试module
    Spring 5 源码环境搭建(1)_第4张图片

Spring 5 源码环境搭建(1)_第5张图片

Spring 5 源码环境搭建(1)_第6张图片

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

你可能感兴趣的:(spring,java)