[英]Groovy in Eclipse not recognizing imports
I am attempting to run a Groovy script in Eclipse but Eclipse is seemingly ignoring all of my import statements. 我试图在Eclipse中运行Groovy脚本,但Eclipse似乎忽略了我的所有import语句。 If I hover over the errors it tells asks me to import the appropriate class (clicking on it does nothing).
如果我将鼠标悬停在错误上,它会告诉我要导入相应的类(单击它不会执行任何操作)。
I have the required jars in my build path and class path. 我的构建路径和类路径中有必需的jar。
Sample code, pretty standard: 示例代码,非常标准:
package scripts.blah
import foo.Bar;
class FooMain {
static main(String[] args){
Bar bar = new Bar();
}
}
Groovy:unable to resolve class Bar Groovy:无法解析类Bar
Any help would be appreciated. 任何帮助,将不胜感激。
Three possibilities: 三种可能性:
Forgot to actually build the project. 忘了实际构建项目。 Ouch.
哎哟。 (build automatically was turned off in Eclipse)
(在Eclipse中自动关闭构建)
Had the same problem. 有同样的问题。 Adding those to my .classpath solved the problem:
将这些添加到我的.classpath解决了这个问题:
<classpathentry exported="true" kind="con" path="GROOVY_SUPPORT"/>
<classpathentry exported="true" kind="con" path="GROOVY_DSL_SUPPORT"/>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.