學習Spring源碼問題總結

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會有點卡,右下角綠條走完就好了。
在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章