“不受约束”是什么意思? Eclipse 中的库或类路径容器?

发布于 2024-11-09 15:55:57 字数 315 浏览 2 评论 0原文

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

GROOVY_SUPPORT 库,带有红色错误-X

它也没有像我预期的那样出现在包资源管理器中。

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

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

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:

GROOVY_SUPPORT library with red error-X

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.

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

初心未许 2024-11-16 15:55:57

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

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

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

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.

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

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.

柒夜笙歌凉 2024-11-16 15:55:57

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

在此处输入图像描述

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.

enter image description here

水波映月 2024-11-16 15:55:57

在 Eclipse 4.5 Mars 和 GRECLIPSE 2.9.2 上遇到

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

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

通过下拉菜单查看项目属性> Java 构建路径 >图书馆>添加库

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

GROOVY_SUPPORT (unbound)

无法删除此条目,因为这会使编译变得不可能。所以去

通过下拉菜单查看项目属性>格罗维>删除 Groovy Nature

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

然后绕圈:

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

一切都像以前一样编译。

这更改了库:

现在不同

“.classpath”的内容已从: 更改

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

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

“.project”的内容未更改。

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

Encountered on Eclipse 4.5 Mars and 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)

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

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

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

GROOVY_SUPPORT (unbound)

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

And circle around:

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

Everything compiles as before.

This changed the Libraries:

Different now

The content of ".classpath" has changed from:

<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.

<natures>
   <nature>org.eclipse.jdt.groovy.core.groovyNature</nature>
   <nature>org.eclipse.jdt.core.javanature</nature>
</natures>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文