我在文档中看到的所有示例都说明了如何通过构建将条目添加到Eclipse项目类路径中。Gradle文件太常见了。它们没有说明如何添加条目:
<classpathentry exported="true", kind="con" path="GROOVY_SUPPORT"/>
文档或书"Gradle Effective Implementation Guide"是非常无用的建议
//closure executed after .classpath content is loaded from existing file
//and after gradle build information is merged
whenMerged { classpath ->
//you can tinker with the Classpath here
}
您可以通过创建org.gradle.plugins.ide.eclipse.model.Container的实例来添加另一个类路径条目:
eclipse {
classpath {
file {
whenMerged { classpath ->
def groovySupportContainer = new org.gradle.plugins.ide.eclipse.model.Container('GROOVY_SUPPORT')
groovySupportContainer.exported = true
classpath.entries << groovySupportContainer
}
}
}
}