什么与应用插件冲突:"org.grails.plugins.views-json"?

What is conflicting with apply plugin: "org.grails.plugins.views-json"?

我正在按照本指南升级我们的 gradle grails 和 gorm 项目 https://docs.grails.org/4.0.0/guide/single.html#upgrading


FAILURE: Build failed with an exception.

* Where:
Build file '/Users/name/Desktop/git/project/app/build.gradle' line: 23

* What went wrong:
A problem occurred evaluating project ':app'.
> org.gradle.api.tasks.SourceSetOutput.getClassesDir()Ljava/io/File;

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

* Get more help at https://help.gradle.org

BUILD FAILED in 4s

有问题的行是apply plugin: "org.grails.plugins.views-json"

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-all.zip
grailsVersion=4.0.4
gormVersion=7.0.4.RELEASE
gradleWrapperVersion=5.0

确保在所有其他应用插件语句之后有 apply plugin 行 views-json,即

apply plugin:"eclipse"
apply plugin:"idea"
apply plugin:"war"
apply plugin:"org.grails.grails-web"
apply plugin:"com.github.erdi.webdriver-binaries"
apply plugin:"org.grails.grails-gsp"
apply plugin:"com.bertramlabs.asset-pipeline"
apply plugin: "org.grails.plugins.views-json"

此外,请确保您已在 build.gradle 文件的顶部指定 JSON 视图依赖项,如下所示(注意这是来自 Grails 4.0.1 应用程序):

buildscript {
    repositories {
        maven { url "https://repo.grails.org/grails/core" }
        maven {
            name = 'ajoberstar-backup'
            url = 'https://ajoberstar.org/bintray-backup'
        }
    }
    dependencies {
        classpath "org.grails:grails-gradle-plugin:$grailsVersion"
        classpath "org.grails.plugins:hibernate5:7.0.0"
        classpath "gradle.plugin.com.github.erdi.webdriver-binaries:webdriver-binaries-gradle-plugin:2.0"
        classpath "com.bertramlabs.plugins:asset-pipeline-gradle:3.0.10"
        classpath "org.grails.plugins:views-gradle:2.0.4"
    }
}

稍后在 build.gradle 文件中再次出现

dependencies {
    developmentOnly("org.springframework.boot:spring-boot-devtools")
    compile "org.springframework.boot:spring-boot-starter-logging"
    ...
    compile "org.grails.plugins:views-json:2.0.4"
}