升级到grails 3.1.13,现在无法解析类org.grails.databinding.converters.web.LocaleAwareNumberConverter

问题描述 投票:0回答:1

无法解析类org.grails.databinding.converters.web.LocaleAwareNumberConverter@第3行,第1列。导入org.grails.databinding.converters.web.LocaleAwareNumberConverter

这是在我将grails从2.2.4升级到3.1.3时发生的

我在build.gradle中缺少依赖项吗?

我遵循了本文档http://docs.grails.org/3.1.1/api/index-all.html,并且发誓要导入正确的类。甚至看起来像基于此https://github.com/grails/grails-core/blob/master/grails-plugin-databinding/src/main/groovy/org/grails/databinding/converters/web/LocaleAwareNumberConverter.groovy

我想念的是什么?这不是LocaleAwareNumberConverter的正确导入吗?

import org.grails.databinding.converters.web.LocaleAwareNumberConverter

这是我的build.gradle

description = 'Internal Tools'

ext {
    grailsVersion = "3.1.3"
}
apply plugin: "org.grails.grails-web"
apply plugin: "war"
apply plugin:"org.grails.grails-gsp"


grails {
    grailsVersion = "3.1.3"
    // springLoadedVersion = '1.2.4.RELEASE'
}

configurations.all {
    // already provided by the JVM, Grails complains if classes show up twice in the classpath
    exclude group: 'xml-apis', module: 'xml-apis'

    exclude module: 'grails-plugin-log4j'

    //provided servlet container
    exclude group: 'javax.el', module: 'el-api'
    exclude group: 'org.glassfish.web', module: 'el-impl'
}

dependencies {
    compile project(':business-logic')
    // test(project(path: ':business-logic', configuration: 'testArtifacts'))

    def slf4jVersion = '1.7.2'
    compile "org.slf4j:jcl-over-slf4j:${slf4jVersion}"
    compile "org.slf4j:jul-to-slf4j:${slf4jVersion}"
    compile "org.slf4j:slf4j-api:${slf4jVersion}"


    // We force a newer version of Ant to work around a bug in the Oracle JRE.  This can be removed when Grails upgrades Ant
    // See Ant 'Bug 54641' for more details
    runtime "org.apache.ant:ant:1.9.2"
    runtime "org.apache.ant:ant-junit:1.9.2"

    // Grails
    runtime "org.grails:grails-dependencies:$grailsVersion"

    compile "org.grails:grails-plugin-validation:3.1.3"
    compile 'org.grails.plugins:converters:4.0.0'

    compile 'org.grails.plugins:gorm-tools:6.1.11-v.12'



    compile "org.grails:grails-core"
    compile "org.grails.plugins:hibernate4"
    compile "org.hibernate:hibernate-core:4.3.11.Final"
    compile "org.hibernate:hibernate-ehcache:4.3.11.Final"



    // Grails plugins
    compile "org.grails.plugins:hibernate4:6.+"
    compile "org.grails.plugins:tomcat:7.0.+"
    compile "org.grails.plugins:export:1.6"
    compile "org.grails.plugins:webflow:2.1.0"
    compile 'org.grails.plugins:logback:0.3.1'
    runtime "org.grails:grails-plugin-validation:$grailsVersion"

    // test "org.grails:grails-test:$grailsVersion"
    // test "org.grails:grails-plugin-testing:$grailsVersion"
    // test 'org.hamcrest:hamcrest-all:1.1'
    // test 'org.mockito:mockito-all:1.8.0'
    // test 'nekohtml:nekohtml:1.9.6.2'

    // bootstrap 'ch.qos.logback:logback-classic:1.1.3'


}

test {
    doFirst {
        tasks.getByPath(':dbTestCreate').ext.testDatabase.create()
    }

    dependsOn(':configProperties')
    jvmArgs '-XX:MaxMetaspaceSize=256m'
    systemProperty 'main.conf.file', "$configOutputDir/main_test.properties"
    String protocol = "file:"
    systemProperty 'logback.configurationFile', protocol + new File(rootProject.projectDir,"dev/log/logback.xml").getAbsolutePath()
}

bootRun {
    dependsOn(':configProperties', ':dbValidate')
    jvmArgs '-XX:MaxMetaspaceSize=256m'
    systemProperty 'main.conf.file', "$configOutputDir/main_dev.properties"
    String protocol = "file:"
    systemProperty 'logback.configurationFile', protocol + new File(rootProject.projectDir,"dev/log/logback.xml").getAbsolutePath()
}

war {
    String protocol = "file:"
    // systemProperty 'logback.configurationFile', protocol + new File(rootProject.projectDir,"dev/log/logback.xml").getAbsolutePath()
}

// We re-package the war so it will include the extra GradleCM meta-info.
// We use a zip task rather than a war task because the war task adds extra files such as a second web.xml
task reWar(type: Zip, dependsOn: ['war']) {
    destinationDir = file("$buildDir/libs")
    extension = 'war'
    // HACK: the input needs to be wrapped in a closure so it is evaluated lazily. This is because the 'war' task output
    // file changes once the version is set
    from { zipTree(war.archiveName) }

    //
    // Build info file
    //
    from (rootProject.buildinfo.filedir) {
        include rootProject.buildinfo.filename
        into 'META-INF'
    }
}

artifacts {
    archives reWar
}

// Ensure tests are run for uploadArchives
uploadArchives.dependsOn('check')

buildscript {
    repositories {
        maven { url "https://repo1.maven.org/maven2/" }
        maven { url "https://dl.bintray.com/jfrog/jfrog-jars/" }
        maven { url "https://repo.gradle.org/gradle/libs-releases-local/" }
        maven { url "https://repo.spring.io/plugins-release/" }
        maven { url "https://repo.maven.apache.org/maven2/" }
        maven { url "https://repo.grails.org/grails/core" }
        mavenCentral()
    }
    dependencies {
        classpath "org.grails:grails-gradle-plugin:3.1.3"
        classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.+"
        classpath "org.gradle:gradle-tooling-api:5.+"
        classpath "org.codehaus.groovy.modules.http-builder:http-builder:0.7.+"
        classpath "org.grails.plugins:hibernate4:${gormVersion-".RELEASE"}"
    }
}

gradle grails groovy
1个回答
0
投票
请参见https://github.com/grails/grails-core/blob/6789d6233745e0fdf53541c107a6220aa570d9c3/grails-plugin-databinding/src/main/groovy/org/grails/plugins/databinding/DataBindingGrailsPlugin.groovy#L32。该代码在Grails 3.1.3中可以正常工作。

该类在grails-plugin-databinding模块中。如果该库在编译时位于依赖关系图中,则导入将起作用。

我在build.gradle中缺少依赖项吗?

没有看到你的build.gradle就无法说。

© www.soinside.com 2019 - 2024. All rights reserved.