2010-09-06 32 views
25

我已經搜索了選項,但我似乎無法找到禁用這些警告的方法。像這樣的警告:煩惱 - 如何禁用Eclipse類路徑條目警告

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

只是在我的項目上沒有任何目的,除了混淆我的「問題」視圖。

回答

27

bug 190783可能與此問題有關。

此警告現在有兩個快速修復:

酮,增加了「dependency」屬性(這是當前快速修復)

酮,增加了「nondependency」屬性;此屬性的添加將顯式地將cp條目排除在外,作爲潛在的發佈/導出依賴關係。如果用戶改變主意,他們可以通過JDT構建路徑UI刪除該屬性。

由於Mondain評論:

我找到了!右鍵點擊警告並選擇快速修復,耶!

那的確是你如何使用快速修復:參見FAQ What is a Quick Fix?Quick Fix,並Quick Assist

alt text

+2

很好找!我很驚訝,它在6個發行版之後還沒有修復(3.0 - > 3.6)。 – 2010-09-06 19:16:12

+0

快速修復在3.6中。它解決了我的問題。 – 2010-09-06 20:12:01

+1

好吧,也許我在這裏玩的是愚蠢的,但我在哪裏設置屬性?我需要文本編輯.classpath文件嗎? – 2010-09-08 00:31:45

1

速戰速決爲整個項目(可能是太貪婪雖然)。假設Linux實用程序(或cygwin):

cp .classpath classpath-bak 
cat classpath-bak | sed '[email protected]^\(\s*<classpathentry kind=.*\)/>\s*[email protected]\1><attributes><attribute name="org.eclipse.jst.component.nondependency" value=""/></attributes></classpathentry>@' > .classpath