1

我最近将我的 grails 项目升级到最新版本,但在启动时遇到以下错误:

|Running application...
Error: Could not find or load main class noverify

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':bootRun'.
> Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

* 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 9s

以下是我的配置文件:

构建.gradle:

buildscript {
    repositories {
        mavenLocal()
        mavenCentral()
        maven { url "https://repo.grails.org/grails/core" }
        maven { url "http://repo.grails.org/grails/plugins/" }
    }
    dependencies {
        classpath "org.grails:grails-gradle-plugin:$grailsVersion"
        classpath "com.bertramlabs.plugins:asset-pipeline-gradle:$assetPipelineVersion"
    }
}

version "1.0.1"
group "com.demo.myapp"

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

sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
    mavenLocal()
    mavenCentral()

    maven { url "https://repo.grails.org/grails/core" }
    maven { url "http://repo.grails.org/grails/plugins/" }
    maven { url "https://dl.bintray.com/animator013/plugins/" }
    maven { url "http://dl.bintray.com/uberall/plugins" }
    maven { url "http://dl.bintray.com/sachinverma/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:${gormVersion-".RELEASE"}"
    compile "org.hibernate:hibernate-ehcache"
    compile "org.jadira.usertype:usertype.core:6.0.1.GA"
    compile "org.grails.plugins:gsp"
    compile "org.grails.plugins:grails-spring-websocket:2.5.0.RC1"

    console "org.grails:grails-console"

    profile "org.grails.profiles:web"

    compile "org.postgresql:postgresql:42.2.5" // POSTGRES
    compile "net.sf.sociaal:freetts:1.2.2"
    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:$assetPipelineVersion"
    runtime "org.grails.plugins:database-migration:3.1.0"
    compile "org.grails.plugins:grails-shiro:4.3"
    compile "org.grails.plugins:audit-logging:3.0.6"
    compile "org.grails.plugins:rest:0.8"
    compile "org.grails.plugins:scaffolding:4.0.0.RC1"
    compile "org.grails.plugins:quartz:2.0.13"
    compile 'org.quartz-scheduler:quartz:2.2.1'

    testCompile "org.grails:grails-test-mixins:3.3.0"
    testCompile "org.grails:grails-gorm-testing-support"
    testCompile "org.grails:grails-web-testing-support"

}

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
    excludes = ['**/*.less','**/*.mp3','**/*.swf']
    enableDigests = true
    skipNonDigests = true //set skipNonDigests to true to help reduce the file size of your final generated project.
    enableGzip = false //set true to generate gzip named versions of assets
    maxThreads = 4
    developmentRuntime = true
}

bootRun {
    jvmArgs('-Dspring.output.ansi.enabled=always',
            'noverify',
            '-XX:TieredStopAtLevel=1',
            '-Xmx1024m')
    sourceResources sourceSets.main
    String springProfilesActive = 'spring.profiles.active'
    systemProperty springProfilesActive, System.getProperty(springProfilesActive)
}

compileGroovy.groovyOptions.forkOptions.jvmArgs = ['-Xmx1024m']

gradle.properties:

grailsVersion=4.0.5
gormVersion=7.0.4.RELEASE
assetPipelineVersion=3.0.10

gradle-wrapper.properties

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

我尝试了Gradle 提供的内容 - 找不到或加载主类,但没有帮助。

关于如何解决这个问题的任何想法?

4

1 回答 1

1

将您的 gradle 版本迁移到 6.1.1

gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
于 2021-09-24T08:03:35.593 回答