我编译的版本为spring framework 5.x版本,所用软件:idea 2019.3.4 ,jdk11,gradle5.6.4。
期间我经历了四个gradle版本,换了两个idea版本,太难了!!!记录一下过程中注意点
1.代码源
github地址https://github.com/spring-projects/spring-framework
国内镜像码云https://gitee.com/mirrors/Spring-Framework
2.因为spring通过gradel构建的所以先需要配置gradle
gradle下载地址https://gradle.org/releases/
版本不能低于5.6 ,低于5.6会出现 plugin with id 'java-test-fixtures' not found;错误
版本过低还可能造成不兼容 jdk11以及Caused by: org.gradle.api.internal.tasks.compile.CompilationFailedException: Compilation failed;等问题
版本不能高于等于6.0,会出现 com.gradle.build-scan 3.2 不支持6.0以及以后的版本
gradle默认仓库太慢可以添加配置,在gradle安装目录下的init.d文件夹创建init.gradle文件
allprojects {
repositories {
maven { url 'file:///E:/apache-maven-repository'}#自己的本地maven仓库地址
mavenLocal()
#gradle-plugin 仓库用于下载 gradle-enterprise-gradle-plugin 3.2版本jar
maven { name "gradle-plugin" ; url "https://maven.aliyun.com/repository/gradle-plugin"}
maven { name "Alibaba" ; url "https://maven.aliyun.com/repository/public" }
maven { name "Bstek" ; url "http://nexus.bsdn.org/content/groups/public/" }
mavenCentral()
}
buildscript {
repositories {
maven { name "gradle-plugin" ; url "https://maven.aliyun.com/repository/gradle-plugin"}
maven { name "Alibaba" ; url 'https://maven.aliyun.com/repository/public' }
maven { name "Bstek" ; url 'http://nexus.bsdn.org/content/groups/public/' }
maven { name "M2" ; url 'https://plugins.gradle.org/m2/' }
}
}
}
3.gradle版本和版本不兼容,升级了idea版本
idea下载https://www.jetbrains.com/idea/download/other.html
gradle5.x版本和idea2018.1.3
错误信息:Receiver class org.jetbrains.plugins.gradle.tooling.util.ModuleComponentIdentifierImpl does not define or inherit an implementation of the resolved method abstract getModuleIdentifier()Lorg/gradle/api/artifacts/ModuleIdentifier; of interface org.gradle.api.artifacts.component.ModuleComponentIdentifier
gradle5.x版本和idea2019.3版本
错误信息:exception during working with external system: java.lang.AssertionError
at org.jetbrains.plugins.gradle.service.project.BaseGradleProjectResolverExtension.createModule(BaseGradleProjectResolverExtension.java:154)
避过这些坑就可以开始学习beans了!!!!!