Errors occurred during the build.
Errors running builder 'Spring Project Builder' on project '專案名'.
org.eclipse.jdt.internal.compiler.env.IBinaryMethod.getParameterAnnotations(I)[Lorg/eclipse/jdt/internal/compiler/env/IBinaryAnnotation;
每次儲存 Java 檔案即彈出錯誤對話框,影響開發效率。
**Eclipse JDT 編譯器與 Spring Tool Suite (STS) 版本不相容**,常見於:
原理:清除所有 `.class` 檔案與建構快取,強制全量重新編譯,修復殘留的不相容位元碼。
影響:失去 Spring 專用驗證(Bean 連線檢查、配置檔驗證),但不影響 Java 編譯與執行。適合非 Spring 專案或臨時規避。
# 關閉 Eclipse 後執行
rm -rf workspace/.metadata/.plugins/org.eclipse.jdt.core/*
rm -rf workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/專案名/*
啟動 Eclipse 時加上 `-clean` 參數:`eclipse.exe -clean`
java.lang.NoSuchMethodError: org.eclipse.jdt.internal.compiler.env.IBinaryMethod.getParameterAnnotations(I)[Lorg/eclipse/jdt/internal.compiler.env/IBinaryAnnotation;
at org.springframework.ide.eclipse.jdt.core.compiler.SpringAnnotationParser.parseAnnotations(SpringAnnotationParser.java:45)
at org.springframework.ide.eclipse.jdt.core.compiler.SpringCompilerParticipant.analyze(SpringCompilerParticipant.java:120)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:900)
明確顯示 **Spring 編譯器參與者** 呼叫 **Eclipse JDT 內部 API** 失敗,證實為版本不匹配。
| Eclipse 版本 | 相容 STS 版本 | Java 版本 |
|---|---|---|
| 2023-09 (4.29) | 4.23.0+ | 17/21 |
| 2022-12 (4.26) | 4.18.0+ | 17 |
| 2022-03 (4.23) | 4.14.0+ | 11/17 |
| 2021-09 (4.21) | 4.11.0+ | 11 |
# 建立測試類別
public class TestBuild { public static void main(String[] args) {} }
# 保存觀察是否彈錯
# 無錯誤 → 修復成功
# 仍報錯 → 嘗試下一個方案
遇到此錯誤**首選 Project → Clean**,90% 以上情況可秒解;若頻發則升級 STS 或遷移至 Spring Tools 4 徹底根治。