烦恼 - 如何禁用 Eclipse 类路径条目警告

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3653785/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 15:05:36  来源:igfitidea点击:

Annoyance - How to disable Eclipse classpath entry warnings

javaeclipse

提问by Paul Gregtheitroade

I've searched the options but I can't seem to find a way to disable these warnings. Warnings such as this:

我已经搜索了选项,但似乎找不到禁用这些警告的方法。像这样的警告:

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

Simply serve no purpose to me on my project other than to clutter my "Problems" view.

除了混淆我的“问题”视图之外,对我的项目没有任何意义。

回答by VonC

bug 190783might be relevant to this question.

错误 190783可能与此问题有关。

this warning will now have two Quick Fixes:

-one that adds the "dependency" attribute (this is the current quick fix)

-one that adds the "nondependency" attribute; the addition of this attribute will explicitly exclude the cp entry from consideration as a potential publish/export dependency. If the user changes their mind, they can remove this attribute via the JDT build path UI.

此警告现在将有两个快速修复:

- 添加“ dependency”属性的一个(这是当前的快速修复)

- 添加“ nondependency”属性的一个;添加此属性将明确排除 cp 条目作为潜在的发布/导出依赖项。如果用户改变主意,他们可以通过 JDT 构建路径 UI 删除此属性。

As Mondaincomments:

正如蒙丹评论的那样:

I found it! Right click on the warning and select quick fix, yay!

我找到了!右键单击警告并选择快速修复,是的!

That is indeed how you can use Quick Fix: See also FAQ What is a Quick Fix?, Quick Fix, and Quick Assist

这确实是您可以使用 Quick Fix 的方式:另请参阅常见问题解答什么是 Quick Fix?快速修复快速协助

alt text

替代文字

回答by Drew Csillag

A quick fix for a whole project (may be too greedy though). Assumes linux utilities (or cygwin):

整个项目的快速修复(虽然可能太贪心了)。假设 linux 实用程序(或 cygwin):

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