环境构建
spring源码阅读环境构建
总流程
https://blog.csdn.net/yelang0/article/details/97747862
1.找不到aspectj
https://blog.csdn.net/cs373616511/article/details/107833530
注意下面这个地方也要添加aspectj,才能编译aj文件
2.报错
Spring源码-Execution failed for task ‘:spring-beans:javadoc‘.报错问题解决方案
在build.gradle -》javadoc中新增 failOnError = false即可规避此类问题
注意是总build.gradle文件
1、gradle版本问题,使用5.5.1
exception during working with external system: java.lang.AssertionError
修改gradle-wrapper.properties文件,我的gradle是5.5.1
distributionUrl=https://services.gradle.org/distributions/gradle-5.5.1-all.zip
2、com.gradle.build-scan 版本
Build file 'D:\work\git\Spring-Framework\build.gradle' line: 16
An exception occurred applying plugin request [id: 'com.gradle.build-scan', version: '1.8']
Failed to apply plugin [id 'com.gradle.build-scan']
This version of Gradle requires version 2.0.2 of the build scan plugin or later.
Please see https://gradle.com/scans/help/gradle-incompatible-plugin-version for more information.
修改:version 2.0.2
3、licenseAgreementUrl 许可协议吧,注释吧
Build file 'D:\work\git\Spring-Framework\build.gradle' line: 24
A problem occurred evaluating root project 'spring'.
Could not set unknown property 'licenseAgreementUrl' for com.gradle.scan.plugin.internal.api.g@60155566 of type com.gradle.scan.plugin.internal.api.h_Decorated.
修改:
buildScan {
// licenseAgreementUrl = "https://gradle.com/terms-of-service"
// licenseAgree = "yes"
publishAlways()
}
4、task wrapper(type: Wrapper) 语法变了
Build file 'D:\work\git\Spring-Framework\build.gradle' line: 296
A problem occurred evaluating root project 'spring'.
Cannot add task 'wrapper' as a task with that name already exists.
修改:
task wrapper(type: Wrapper) {
}
为:
wrapper{
}
5、注释属性 values for class: org.gradle.api.internal.tasks.DefaultTaskDependency Possible solutions: values
Build file 'D:\work\git\Spring-Framework\spring-beans\spring-beans.gradle' line: 29
A problem occurred evaluating project ':spring-beans'.
No such property: values for class: org.gradle.api.internal.tasks.DefaultTaskDependency Possible solutions: values
修改:
注释掉 compileGroovy.dependsOn = compileGroovy.taskDependencies.values - "compileJava"
6.xml-apis:xml-apis
POM relocation to an other version number is not fully supported in Gradle : xml-apis:xml-apis:2.0.2 relocated to xml-apis:xml-apis:1.0.b2.
Please update your dependency to directly use the correct version 'xml-apis:xml-apis:1.0.b2'.
Resolution will only pick dependencies of the relocated element. Artifacts and other metadata will be ignored.
修改build.gradle文件找到configurations.all添加xml-apis
configurations.all {
resolutionStrategy {
force 'xml-apis:xml-apis:1.0.b2'
}
}
7.Execution failed for task ':spring-oxm:genJaxb'.
判断是“includeantruntime” 参数没有设置,遂根据此提示找到spring-framework-5.2.19.RELEASE/spring-oxm文件夹下的spring-oxm.gradle文件进行修改。
添加配置:includeantruntime: false(如图)
![[115574813236536.png]]
8.Kotlin: Language version 1.2 is no longer supported; please, use version 1.3 or greater.
打开build.gradle,找到compileKotlin和compileTestKotlin,并修改kotlin版本为较新的版本:
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs = ["-Xjsr305=strict"]
apiVersion = "1.4"
languageVersion = "1.4"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs = ["-Xjsr305=strict"]
apiVersion = "1.4"
languageVersion = "1.4"
}
}
9.跳过task
task notALib {
enabled = false
}
10.跳过api task
添加enabled