当我尝试i18nFields
在我的域类中使用以支持多种语言时,我得到重复的方法名称/签名编译失败。
Grails 版本:2.3.7(我尝试使用 2.3.4 并遇到同样的问题并升级了)
来自 Grails 的文档是http://grails.org/plugin/i18n-fields
我的域类看起来像
package com.sampleapp.domain
import i18nfields.I18nFields;
@I18nFields
class Products {
def name
static constraints = {}
static i18nFields = ['name']
}
MyConfig.groovy
包含以下行以指定语言环境
// internationalization support - testing
i18nFields {
locales = ['en','es']
}
BuildConfig.groovy 插件定义
plugins {
// plugins for the build system only
build ":tomcat:7.0.47"
// plugins for the compile step
compile ":scaffolding:2.0.1"
compile ':cache:1.1.1'
// plugins needed at runtime but not for compilation
runtime ":hibernate:3.6.10.6" // or":hibernate4:4.1.11"//
runtime ":database-migration:1.3.8"
runtime ":jquery:1.10.2.2"
// compile ":jquery-ui:1.10.2.2"
runtime ":resources:1.2.1"
// Uncomment these (or add new ones) to enable additional resources capabilities
runtime ":zipped-resources:1.0.1"
runtime ":cached-resources:1.1"
//runtime ":yui-minify-resources:0.1.5"
compile ':platform-core:1.0.RC6'
compile ":cache-headers:1.1.5"
runtime ':spring-security-core:2.0-RC2'
// internationalization
compile ":i18n-fields:0.8.1"
}
编译错误是
grails-workspace\Test\grails-app\domain\com\sampleapp\domain\Products.groovy: -1: Repetitive method name/signature for method 'void setName_es(java.lang.String)' in class 'com.sampleapp.domain.Products'.
@ line -1, column -1.
对 en 和 es 语言环境的 name 属性重复错误两次。
如果我删除 i18nFields 注释并且示例应用程序在此之前运行良好,则没有错误。我在控制器帖子中验证了 GGTS 重复方法名称/签名错误,以发现控制器中的类似错误。我还验证以确保 groovy 版本是正确的,在我的情况下它是 2.1
有人可以给我任何关于我应该在哪里解决这个问题的指示。