1. 环境介绍
jdk1.8+Gradle5.6+idea2019.3,构建版本spring-framework-5.1.x
2. Gradle5.6配置
3. idea+Gradle配置
- 本人使用的是idea 2019.3(破解文件自行查找)
4. Spring源码下载
Spring源码下载地址链接:
https://pan.baidu.com/s/1qzqbLB1jgfsELuRQLkujPA
提取码:0azk
编译之后的Spring源码下载地址
链接:https://pan.baidu.com/s/1AVaRYnJq9yfIhdBXKhvMUQ
提取码:fsfe
5. idea+Spring的配置
- 首要要构建,下图红框中对应的spring-oxm项目模块,构建spring项目中也有写到
- 在命令行中输入:
gradlew :spring-oxm:compileTestJava
- 导入项目之后,修改下图文件相应的配置
- 注释对应的代码
- 注释对应的代码
- 修改对应的代码块
-
task schemaZip(type: Zip) { group = "Distribution" baseName = "spring-framework" classifier = "schema" description = "Builds -${classifier} archive containing all " + "XSDs for deployment at https://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 } } } }
6. 坑点总结
-
Plugin [id: 'io.spring.dependency-management', version: '1.0.5.RELEASE', apply: false] was not found in any of the following sources:
解释:报以上错误,是因为环境配置的有问题,修改idea中配置gradle对应的配置,修改为gradle
2. 下载过慢,可以配置阿里云镜像仓库,但是不要将原来的进行仓库进行注释,否则会出现乱七八糟的问题