记录一下学习源码遇到的问题:
- 1. 编译时报错:Failed to apply plugin [id 'com.gradle.build-scan']
- 2. 报错Groovy:compiler mismatch project levelis :2.4 Workspace level is 2.5
1. 编译时报错:Failed to apply plugin [id ‘com.gradle.build-scan’]
把spring源码clone下来之后,使用gradle编译不通过,异常日志如下:
FAILURE: Build failed with an exception.
* Where:
Build file 'E:\code\spring-framework-5.0.2.RELEASE\build.gradle' line: 15
* What went wrong:
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.
原因是gradle版本太高了,具体参考:https://docs.gradle.com/enterprise/compatibility/#build_scan_plugin
可以移步到这个网站下载:http://services.gradle.org/distributions/
2. 报错Groovy:compiler mismatch project levelis :2.4 Workspace level is 2.5
在spring-beans
项目下的test文件夹下面新建测试类,提示这个问题。
原因: Groovy编译器级别与项目版本不匹配。
解决方法:在当前项目上点右键,属性 Properties,Groovy Compiler配置编译版本与项目的编译设置版本一致。
我这里是提示2.4,然后改为2.5就可以了。
然后spring-context
也提示同样的问题,修改之后,eclipse就开始重新编译所有的子项目。这时eclipse会有点卡,右下角绿条走完就好了。