【发布时间】:2013-04-12 09:49:10
【问题描述】:
在项目上运行 gradle cleanEclipse Eclipse 后,它失去了 Groovy 特性。我怎样才能自动设置这种性质,或者只是对 Gradle 说不要管它。
编辑: 根据dodoc,我可以在build.gradle中写:
eclipse {
project {
natures 'some.extra.eclipse.nature', 'some.another.interesting.nature'
}
}
但是,groovy 性质的名称是什么,或者我怎么能得到它?
我去.project看看:
<natures>
<nature>org.eclipse.jdt.groovy.core.groovyNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>bndtools.core.bndnature</nature>
</natures>
org.eclipse.jdt.groovy.core.groovyNature - 这是自然名称
我正在添加apply plugin: "groovy",正如@Peter Niederwieser 建议的那样(感谢+1)
但是
运行gradle cleanEclipse Eclipse 后我有正确的.project 文件,并且该项目的图标上有“G”,但在.classpath 中没有两行:
<classpathentry exported="true" kind="con" path="GROOVY_SUPPORT"/>
<classpathentry exported="true" kind="con" path="GROOVY_DSL_SUPPORT"/>
当我手动设置 Groovy 特性时,它就存在了。
看来,这些行很重要,因为在该变体中,即使在编译级别,项目也会显示错误 - 它看不到一些 Groovy 方法。
【问题讨论】:
-
仍在旧版本的 Eclipse 上运行?如果是这样,由于你没有得到这个 when you asked it before 的答案,我会按照 Peter Niederwieser 给你的建议在 groovy-eclipse 邮件列表中提问
-
我不是唯一一个从事这个项目的人。是的,它是 3.6,我还不能更改它。
-
@tim_yates 问题出在 Gradle 上,而不是 Eclipse。 Gradle 是最后一个版本。