gradle - Grails 3.3.10中的org.codehaus.groovy.runtime.DefaultGroovyMethods错误

标签 gradle intellij-idea grails

我正在尝试在Grails 3.3.10中运行Intellij应用程序,但在启动该应用程序时遇到了以下错误,我也使用了grails-clean,然后尝试了但仍遇到相同的错误

APPLICATION FAILED TO START

 Description:

An attempt was made to call the method org.codehaus.groovy.runtime.DefaultGroovyMethods.collect([Ljava/lang/Object;Lgroovy/lang/Closure;)Ljava/util/List; but it does not exist. Its class, org.codehaus.groovy.runtime.DefaultGroovyMethods, is available from the following locations:

    jar:file:/C:/Users/Sherif/.gradle/caches/modules-2/files-2.1/org.codehaus.groovy/groovy/2.4.17/9a38b95a08a80b90fbff89726f6f7e7d8bac3ac5/groovy-2.4.17.jar!/org/codehaus/groovy/runtime/DefaultGroovyMethods.class

It was loaded from the following location:

    file:/C:/Users/Sherif/.gradle/caches/modules-2/files-2.1/org.codehaus.groovy/groovy/2.4.17/9a38b95a08a80b90fbff89726f6f7e7d8bac3ac5/groovy-2.4.17.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of org.codehaus.groovy.runtime.DefaultGroovyMethods

我的环境规格如下:

JAVA:1.8.0.211,
操作系统:Windows 10 64bit,
Cereal :3.3.10,
IDE:Intellij

如何解决这个错误?

这是build.gradle:
buildscript {
    repositories {
        mavenLocal()
        maven { url "https://repo.grails.org/grails/core" }
    }
    dependencies {
       classpath "org.grails:grails-gradle-plugin:$grailsVersion" 
        classpath "org.grails.plugins:hibernate5:${gormVersion-".RELEASE"}"
        classpath "com.bertramlabs.plugins:asset-pipeline-gradle:2.15.1"
       //classpath "org.amcworld.plugins:i18n-asset-pipeline:2.0.0"
    }
}

version "0.1"
group "fb3"

apply plugin:"eclipse"
apply plugin:"idea"
apply plugin:"war"
apply plugin:"org.grails.grails-web"
apply plugin:"asset-pipeline"
apply plugin:"org.grails.grails-gsp"

repositories {
    mavenLocal()
    maven { url "https://repo.grails.org/grails/core" }
    maven { url "https://repo.grails.org/grails/plugins" }
}

dependencies {
    compile "org.springframework.boot:spring-boot-starter-logging"
    compile "org.springframework.boot:spring-boot-autoconfigure"
    compile "org.grails:grails-core"
    compile "org.springframework.boot:spring-boot-starter-actuator"
    compile "org.springframework.boot:spring-boot-starter-tomcat"
    compile "org.grails:grails-web-boot"
    compile "org.grails:grails-logging"
    compile "org.grails:grails-plugin-rest"
    compile "org.grails:grails-plugin-databinding"
    compile "org.grails:grails-plugin-i18n"
    compile "org.grails:grails-plugin-services"
    compile "org.grails:grails-plugin-url-mappings"
    compile "org.grails:grails-plugin-interceptors"
    compile "org.grails.plugins:cache"
    compile "org.grails.plugins:async"
    compile "org.grails.plugins:scaffolding"
    compile "org.grails.plugins:events"
    compile "org.grails.plugins:hibernate5"
    compile "org.hibernate:hibernate-core:5.1.16.Final"
    compile "org.grails.plugins:gsp"
    compile 'org.grails.plugins:mail:2.0.0'
    compile 'org.grails.plugins:quartz:2.0.13'
    compile 'org.grails.plugins:quartz-monitor:1.3'
    compile 'org.grails.plugins:remote-pagination:0.5.0'
    compile "org.grails.plugins:jquery:1.11.1"
    compile "org.grails.plugins:jquery-validation:1.9"
    compile 'org.grails.plugins:spring-security-core:4.0.0.RC2'
    compile 'org.grails.plugins:spring-security-ui:4.0.0.M1'
    compile group: 'mysql', name: 'mysql-connector-java', version: '8.0.11'
    compile "com.stripe:stripe-java:10.11.0"  //7.7.0
    runtime 'com.google.guava:guava:21.0' 
    runtime 'org.grails.plugins:i18n-asset-pipeline:2.0.0'
  console "org.grails:grails-console"
   profile "org.grails.profiles:web"
    runtime "org.glassfish.web:el-impl:2.1.2-b03"
    runtime "com.h2database:h2"
    runtime "org.apache.tomcat:tomcat-jdbc"
    runtime "com.bertramlabs.plugins:asset-pipeline-grails:2.15.1"
    testCompile "org.grails:grails-gorm-testing-support"
    testCompile "org.grails.plugins:geb"
    testCompile "org.grails:grails-web-testing-support"
    testCompile "org.grails.plugins:geb:1.1.2"
    testRuntime "org.seleniumhq.selenium:selenium-htmlunit-driver:2.47.1"
    testRuntime "net.sourceforge.htmlunit:htmlunit:2.18"
    testRuntime "org.seleniumhq.selenium:selenium-chrome-driver:2.47.1"
}

bootRun {
    jvmArgs('-Dspring.output.ansi.enabled=always')
    addResources = true
    String springProfilesActive = 'spring.profiles.active'
    systemProperty springProfilesActive, System.getProperty(springProfilesActive)
}

tasks.withType(Test) {
    systemProperty "geb.env", System.getProperty('geb.env')
    systemProperty "geb.build.reportsDir", reporting.file("geb/integrationTest")
    systemProperty "webdriver.chrome.driver", System.getProperty('webdriver.chrome.driver')
    systemProperty "webdriver.gecko.driver", System.getProperty('webdriver.gecko.driver')
}

assets {
    minifyJs = true
    minifyCss = true
}

最佳答案

通过将以下依赖项添加到build.gradle中,我能够解决此特定问题:

compile "org.codehaus.groovy:groovy-all:2.4.17"


雷姆知道这是否有帮助。

关于gradle - Grails 3.3.10中的org.codehaus.groovy.runtime.DefaultGroovyMethods错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57351673/

相关文章:

android - 通过 Gradle 构建将 Android AAR 库部署到 Artifactory 失败并出现错误 "Error deploying artifact: Error transferring file"

java - 当使用 Windows 系统帐户构建应用程序时,Android 构建失败 (aapt2)

java - 为什么找不到spring Boot {}?

javascript - Textarea没有显示结果

grails - 访问 Grails UserDetailsS​​ervice 中的参数

android - Gradle依赖关系下载Jars

java - 为什么我需要编译才能使 Groovy 代码工作?

java - Intellij IDEA 无法启动

git - 字符串 'Head' 不代表修订号

grails - Micronaut 读取超时异常