build.gradle文件应该支持导入标准groovy库 [英] What should be in the build.gradle file to support imports of the standard groovy libraries
问题描述
我创建了一个常规项目。它本身起作用。
在添加了一些内容之后,我不得不在库中添加一个新的库。
整个工作区在Gradle上运行,我将相应的Maven引用添加到gradle.build文件中。
$ b 运行
gradle cleanEclipse Eclipse
后,新库运行正常。 但是。所有对Groovy库的项目引用都消失了。愚蠢的我,我不得不把一些引用到gradle.build中。
库的列表:
groovy.util.slurpersupport
groovy.xml
org.codehaus.groovy.tools.xml
groovy.lang
但我不知道如何将它们包含到gradle.build中。我无法在Maven存储库中找到它们。即使如此,我已将它们安装在Eclipse中,我应该采取这些措施。我无法谷歌任何帮助,因为gradle groovy给出了如何从groovy调用gradle的结果,而不是反过来。
/ groackoverflow.com/questions/11526431/moving-from-plain-groovy-to-gradle\">从普通的Groovy到Gradle的移动不会有帮助,它确实是关于从Groovy调用java库的gradle支持。我没有反对从Maven代码获取依赖关系,但我不知道如何在我的情况下做到这一点 - 问题是,我有Eclipse 3.6 。我应该使用Eclipse 3.6的最新版Groovy。所以,我已经从 http://dist.codehaus安装了它。组织/常规/发行/ greclipse /快照/ e3.6 / 。我不知道什么是Maven的等效版本 - 没有关于它的信息。 解决方案
有一些错误在Eclipse安装中的groovy中。现在运行
gradle cleanEclipse Eclipse
后,build.gradle对groovy没有依赖关系,几乎所有东西都运行正常,我只需要将groovy特性添加到项目中。 b $ bI had created a groovy project. It worked by itself.
After some additions I had to add a new jar of a new library into the imports.
While the whole workspace runs on Gradle, I added the appropriate Maven reference to the gradle.build file.
After running gradle cleanEclipse Eclipse
the new library works OK.
But. All project references to the Groovy libraries disappeared. Foolish me, I had to put some references to them into the gradle.build, too.
The list of libraries:
groovy.util.slurpersupport
groovy.xml
org.codehaus.groovy.tools.xml
groovy.lang
But I don't know how to include them into gradle.build. I can't found them in maven repository. And even so, I have them installed in my Eclipse, and I should take these. And I can't google any help, because gradle groovy gives the results on how to call gradle from groovy, not vice versa.
Moving from plain Groovy to Gradle won't help, it is really about gradle support for calling a java library from groovy.
I have nothing against getting dependencies from Maven rep., but I don't know how to do it in my case - The problem is, that I have Eclipse 3.6. And I should use the last version of groovy for Eclipse 3.6. So, I have installed it from http://dist.codehaus.org/groovy/distributions/greclipse/snapshot/e3.6/. And I don't know what is the equivalent version in Maven - there is no info about it.
There was some error in the groovy in Eclipse installation. Now after running gradle cleanEclipse Eclipse
while build.gradle has NO dependencies to groovy, almost everything runs OK, I only have to add the groovy nature to the project
这篇关于build.gradle文件应该支持导入标准groovy库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!