Eclipse 中的“未绑定”库或类路径容器是什么意思?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6143837/
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 16:21:22  来源:igfitidea点击:

What is meant by an "unbound" library or classpath container in Eclipse?

javaeclipseidegroovyclasspath

提问by Kaypro II

While recently imported a new project into eclipse, at one point when I tried to add the GROOVY_SUPPORT library it would up as "unbound" with error-X, like this:

虽然最近将一个新项目导入到 eclipse 中,但有一次当我尝试添加 GROOVY_SUPPORT 库时,它会以错误-X 显示为“未绑定”,如下所示:

GROOVY_SUPPORT library with red error-X

带有红色错误-X 的 GROOVY_SUPPORT 库

It also did not appear in the package explorer as I expected.

它也没有像我预期的那样出现在包浏览器中。

What precisely does this mean? Eclipse did not report any other errors. All I have it the red-X and the unbound message.

这究竟是什么意思?Eclipse 没有报告任何其他错误。我只有红色 X 和未绑定的消息。

I was able to fix this via futzing with stuff (specifically removing and re-adding the Groovy nature) until it went away, but I'm curious about what was really going on.

我能够通过使用一些东西(特别是删除和重新添加 Groovy 性质)来解决这个问题,直到它消失为止,但我很好奇到底发生了什么。

采纳答案by Michael Rutherfurd

Usually it means that the classpathentry in the .classpath can't be resolved. I usually see this when opening a project that was created/updated with a different plugin (or version) defining the classpath container that is unbound.

通常表示.classpath中的classpathentry无法解析。我通常在打开使用定义未绑定类路径容器的不同插件(或版本)创建/更新的项目时看到这一点。

If you compare the .classpath file from when it was unbound to after the problem was fixed you should see the difference.

如果将 .classpath 文件从解除绑定到问题解决后进行比较,您应该会看到差异。

Fixing the problem the way you did (removing the unbound contain and re-adding it, as you did via the Groovy nature) is a simple way to fix the problem. One caveat, if you are part of a team working on the project and you get this problem then it would be a good idea to ensure all team members are on the same release of the IDE.

按照您的方式解决问题(删除未绑定的包含并重新添加它,就像您通过 Groovy 性质所做的那样)是解决问题的简单方法。一个警告,如果您是该项目团队的一员并且遇到此问题,那么最好确保所有团队成员都使用相同版本的 IDE。

回答by Ari Gesher

I just ran into this exact problem. It turns out I had not installed the Groovy Eclipse SDK features. Once I had them installed, GROOVY_SUPPORT was no longer unbound and everything worked.

我刚刚遇到了这个确切的问题。结果证明我没有安装 Groovy Eclipse SDK 功能。一旦我安装了它们, GROOVY_SUPPORT 就不再是未绑定的并且一切正常。

enter image description here

在此处输入图片说明

回答by David Tonhofer

Encountered on Eclipse 4.5 Mars and GRECLIPSE 2.9.2

在 Eclipse 4.5 Mars 和 GRECLIPSE 2.9.2 上遇到

I had a few Groovy projects, imported before GRECLIPSE had been installed (but the Groovy compiler was on the path and GROOVY_HOME was set)

我有几个 Groovy 项目,在安装 GRECLIPSE 之前导入(但 Groovy 编译器在路径上并且设置了 GROOVY_HOME)

After GRECLIPSE installation, the projects wouldn't compile. So go to

安装 GRECLIPSE 后,项目将无法编译。所以去

Project Properties via Pulldown Menu > Java Build Path > Libraries > Add Library

通过下拉菜单 > Java 构建路径 > 库 > 添加库的项目属性

And add "GROOVY SUPPORT" manually. The project compiles but:

并手动添加“GROOVY SUPPORT”。该项目编译但:

GROOVY_SUPPORT (unbound)

GROOVY_SUPPORT(未绑定)

This entry cannot be removed because this makes compilation impossible. So go to

无法删除此条目,因为这会导致无法编译。所以去

Project Properties via Pulldown Menu > Groovy > Remove Groovy Nature

"Do you want to also remove the groovy runtime jars from project FOO?" YES

通过下拉菜单 > Groovy > 删除 Groovy Nature 的项目属性

“您还想从项目 FOO 中删除 groovy 运行时 jars 吗?” 是的

And circle around:

然后绕一圈:

Project Properties via Pulldown Menu > Configure > Convert to Groovy Project

通过下拉菜单 > 配置 > 转换为 Groovy 项目的项目属性

Everything compiles as before.

一切都像以前一样编译。

This changed the Libraries:

这改变了图书馆:

Different now

现在不同了

The content of ".classpath" has changed from:

“.classpath”的内容从:

<classpathentry exported="true" kind="con" path="GROOVY_DSL_SUPPORT"/>
<classpathentry kind="con" path="GROOVY_SUPPORT"/>

to

<classpathentry exported="true" kind="con" path="GROOVY_SUPPORT"/>
<classpathentry exported="true" kind="con" path="GROOVY_DSL_SUPPORT"/>

The content of ".project" has not changed.

“.project”的内容没有改变。

<natures>
   <nature>org.eclipse.jdt.groovy.core.groovyNature</nature>
   <nature>org.eclipse.jdt.core.javanature</nature>
</natures>