1

我有一个 build.gradle 文件(来自手册中的自定义插件示例),内容如下:

apply plugin: 'groovy'

dependencies {
compile gradleApi()
compile localGroovy()
}

但是当我跑步时,我得到:

$ gradle build
:compileJava UP-TO-DATE
:compileGroovy

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileGroovy'.
> You must assign a Groovy library to the 'groovy' configuration.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

知道我缺少什么吗?

4

2 回答 2

2

确保您同时拥有:

apply plugin: 'groovy'

并在依赖项部分使用groovy关键字(而不是使用compile关键字):

dependencies {
   groovy 'org.codehaus.groovy:groovy-all:2.0.8
}

所有功劳归功于这个博客

于 2013-09-04T23:59:14.583 回答
1

简短的回答,升级到更新的版本。

上述问题(以及更多问题)发生在 v1.0.8 上,升级到 v1.6 并且一切正常

于 2013-07-19T09:16:52.390 回答