Classpath entry org.eclipse.jdt.junit.JUNIT_CONTAINER/5 will not be exported or published. 的修復

今天在學習junit4測試的時實現例子的時候,當我在java build path加入junit4的包之後,eclipse顯示了一個warning,

Classpath entry org.eclipse.jdt.junit.JUNIT_CONTAINER/4 will not be exported or published. Runtime ClassNotFoundExceptions may result.

於是我在網上百度了之後發現,一個回答,和我遇到的問題類似,但是不完全相同,她所使用的方法是eclipse的快速修復,非常另類,我試着用這個方法解決了我的問題,雖然不明白是什麼原理,但是我覺得這種另類的快速修復的方法值得學習.
Classpath entry org.eclipse.jdt.USER_LIBRARY/hibernate lib will not be exported or published.Runtime ClassNotFoundExceptions may result.

1、啓用Maven Dependency後,提示上面的警告。

解決方法是:打開Problem視圖,選中此警告,然後按Ctrl+1或者右擊選擇fix it,彈出修復對話框,選擇 “Exclude the associated raw classpath entry….”

這個操作好像是添加了下面這個attribute到 .classpath:





2、還一種是我把字符集改成UTF-8後,這個提示就直接沒了,不知道跟字符集是否有關

注意第一種快速修復的方法,雖然我已經會了在編寫代碼的時候用到快速修復,但是這種方法也必須學會,很有用的!

轉載於:https://www.cnblogs.com/com-wushuang/p/5359418.html

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