今天在學習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:
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</classpathentry>
2、還一種是我把字符集改成UTF-8后,這個提示就直接沒了,不知道跟字符集是否有關
注意第一種快速修復的方法,雖然我已經會了在編寫代碼的時候用到快速修復,但是這種方法也必須學會,很有用的!
