“找到的方法:'compileOnly()”与Intellij和Gradle 3.5.1

时间:2017-08-28 13:32:57

标签: intellij-idea gradle

我无法弄清楚为什么在Intellij上刷新我的Gradle项目时我一直得到Error:(28, 0) Build script error, unsupported Gradle DSL method found: 'compileOnly()'!。这是我build.gradle的相关部分:

dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.11'
    compileOnly 'org.projectlombok:lombok:1.16.18'
    compile group: 'com.google.guava', name: 'guava', version: '22.0'
}

我正在使用gradle 3.5.1:

$ gradle -v

------------------------------------------------------------
Gradle 3.5.1
------------------------------------------------------------

Build time:   2017-06-16 14:36:27 UTC
Revision:     d4c3bb4eac74bd0a3c70a0d213709e484193e251

Groovy:       2.4.10
Ant:          Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM:          1.8.0_66 (Oracle Corporation 25.66-b18)
OS:           Windows 10 10.0 amd64

如果按照建议here打印GRADLE_HOME,我也会这样做:

$ gradle getHomeDir

:getHomeDir
C:\Program_Files\gradle-3.5.1

BUILD SUCCESSFUL

gradle build从命令行运行正常。我尝试按照IDEA的建议添加apply plugin: 'idea',并从命令行运行gradle idea,但我仍然遇到这个问题。

这些是我的Gradle设置:

Gradle settings

0 个答案:

没有答案