gradle - 提供者org.jetbrains.plugins.gradle.tooling.builder.WarModelBuilderImpl无法实例化

标签 gradle intellij-idea

我正在编写Pro Spring MVC:With Web Flow这本书的示例代码。

但是,当我尝试导入Gradle项目时收到以下错误:

原因:org.jetbrains.plugins.gradle.tooling.ModelBuilderService:提供程序org.jetbrains.plugins.gradle.tooling.builder.WarModelBuilderImpl无法实例化

这是父项目的build.gradle文件:

apply plugin: 'base'

ext.springVersion = '3.2.3.RELEASE'
ext.tilesVersion = '2.2.2'
ext.springSecurityVersion = '3.1.4.RELEASE'
ext.springSwfVersion = '2.3.2.RELEASE'
ext.hibernateVersion = '4.2.3.Final'
ext.hibernateValidatorVersion = '5.0.1.Final'
ext.ehCacheVersion = '2.7.2'
ext.aspectJVersion = '1.7.3'

ext.tomcatVersion = '7.0.42'
ext.cargoVersion = '1.3.3'

ext.webProjects = subprojects.findAll { project -> project.name.endsWith('bookstore') }

buildscript {
    repositories {
        maven { url 'http://jcenter.bintray.com/' }
    }

    dependencies {
        classpath 'org.gradle.api.plugins:gradle-tomcat-plugin:1.2.4'
        classpath 'org.gradle.api.plugins:gradle-cargo-plugin:1.5'
    }
}

allprojects {

    description = 'Bookstore Sample Application'

    group = 'com.apress.prospringmvc'

    version = '1.0.0'

    repositories {
        mavenRepo url: 'http://maven.springframework.org/release'
        mavenRepo url: 'http://maven.springframework.org/snapshot'
        mavenCentral()
        mavenRepo url: 'http://maven.springframework.org/milestone'
        mavenRepo url: 'https://repository.jboss.org/nexus/content/repositories/releases/'
        mavenRepo url: 'http://download.java.net/maven/glassfish/org/glassfish/'
    }

    tasks.withType(Compile) {
        options.compilerArgs << "-g"
    }
}

configure(webProjects) {
    apply plugin: 'war'
    apply plugin: 'jetty'
    apply plugin: 'tomcat'
    apply plugin: 'cargo'

    dependencies() {
        compile project(':bookstore-shared'), project(':bookstore-web-resources')

        compile "org.apache.tiles:tiles-servlet:$tilesVersion"
        compile "org.apache.tiles:tiles-jsp:$tilesVersion"
        compile "org.apache.tiles:tiles-api:$tilesVersion"
        compile "org.apache.tiles:tiles-core:$tilesVersion"

        runtime "jstl:jstl:1.2"

        providedCompile 'javax.servlet:javax.servlet-api:3.0.1'

        tomcat "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}",
                "org.apache.tomcat.embed:tomcat-embed-logging-juli:${tomcatVersion}"
        tomcat("org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}") {
            exclude group: 'org.eclipse.jdt.core.compiler', module: 'ecj'

            cargo "org.codehaus.cargo:cargo-core-uberjar:${cargoVersion}",
                    "org.codehaus.cargo:cargo-ant:${cargoVersion}"
        }
    }

    cargo {
        containerId = 'tomcat7x'
        port = 8080

        local {
            homeDir = file('container/apache-tomcat-7.0.42')
            output = file('container/apache-tomcat-7.0.42/output.log')
        }
    }

    war {
        version = '' //We do this to make the wars versionless, when they are deployed with cargo, the context
        //root of the app is equal to the file name, which is equal to the sample directory name.
    }

    task systemTest(type: Test) {
        include '**/*FrontendTest.*'
        dependsOn(war)

        doFirst {
            cargoStartLocal.execute()
        }
    }

    test {
        exclude '**/*FrontendTest.*'
    }

}


subprojects() {
    apply plugin: 'java'
    apply plugin: 'eclipse-wtp'
    apply plugin: 'idea'

    sourceCompatibility = 1.7
    targetCompatibility = 1.7

    dependencies() {
        compile "org.springframework:spring-orm:$springVersion"
        compile "org.springframework:spring-aop:$springVersion"
        compile "org.springframework:spring-webmvc:$springVersion"
        compile "org.springframework:spring-oxm:$springVersion"

        compile 'org.slf4j:jcl-over-slf4j:1.7.2'
        compile 'ch.qos.logback:logback-classic:1.0.9'
        compile 'org.apache.commons:commons-lang3:3.0.1'
        compile 'com.thoughtworks.xstream:xstream:1.4.2'
        compile 'com.h2database:h2:1.3.168'
        compile 'cglib:cglib-nodep:2.2.2'
        compile "org.aspectj:aspectjrt:$aspectJVersion"
        compile "org.aspectj:aspectjweaver:$aspectJVersion"

        compile "org.hibernate:hibernate-entitymanager:$hibernateVersion"
        compile "org.hibernate:hibernate-core:$hibernateVersion"
        compile "org.hibernate:hibernate-ehcache:$hibernateVersion"
        compile "org.hibernate:hibernate-validator:$hibernateValidatorVersion"
        compile "net.sf.ehcache:ehcache:$ehCacheVersion"

        compile 'com.lowagie:itext:2.1.7'
        compile 'net.sourceforge.jexcelapi:jxl:2.6.12'
        compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.11'
        compile 'commons-codec:commons-codec:1.6'
        compile 'joda-time:joda-time:2.1'

        testCompile 'junit:junit:4.11'
        testCompile "org.springframework:spring-test:$springVersion"
    }

    eclipse {
        project.natures "org.springframework.ide.eclipse.core.springnature"
    }

}

task wrapper(type: Wrapper) { gradleVersion = '1.6' }

我能做什么?

最佳答案

提升gradle版本是我目前唯一的解决方案; 4.0应该工作:

更改:

task wrapper(type: Wrapper) { gradleVersion = '1.6' }

至:
task wrapper(type: Wrapper) { gradleVersion = '4.0' }

我试图解决它到目前为止使用1.7的其他方法-失败。

关于gradle - 提供者org.jetbrains.plugins.gradle.tooling.builder.WarModelBuilderImpl无法实例化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55120872/

相关文章:

java - 为什么使用if语句或assertj比较相同的对象值总是给出错误?

java - 为什么 intellij 代码自动完成不起作用?

java - IDEA Java swing GUI 形式 Jtable。表模型被自动生成的代码覆盖

java - 错误 : Failed to resolve: com. android.support :cardview-v7:23. 4.0

Gradle:从父构建脚本配置子项目(模块)

android - 无法解析com.google.android.gms.play-service:8.1.0

java - 更改 IntelliJ 代码构造符号

java - com.sun.tools.javac.util 在 openjdk 8 中可用吗?

android - 找不到gradle android commonsware maven

java - 使用 Spring 框架的 WebSocketClient 时如何修复 NoClassDefFoundError