gpt4 book ai didi

groovy - 用于定义关系的常规静态 block

转载 作者:行者123 更新时间:2023-12-02 15:15:04 24 4
gpt4 key购买 nike

我定义了几个域类Employee和EmployeeDesiredSkill,

员工有

 static hasMany = [employeeSkill:EmployeeDesiredSkill]

和EmployeeDesiredSkill具有
static belongsTo = [employee:Employee]

但是groovyc给了我很多错误,如下所示:
[groovyc] Compiling 15 source files to C:\dev\JavaTest\target\classes
[groovyc] org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
[groovyc] C:\dev\JavaTest\grails-app\domain\javatest\Employee.groovy: 6: Apparent variable 'EmployeeDesiredSkill' was found in a static scope but doesn't refer to a local variable, static field or class. Possible causes:
[groovyc] You attempted to reference a variable in the binding or an instance variable from a static context.
[groovyc] You misspelled a classname or statically imported field. Please check the spelling.
[groovyc] You attempted to use a method 'EmployeeDesiredSkill' but left out brackets in a place not allowed by the grammar.
[groovyc] @ line 6, column 44.
[groovyc] ny = [employeeDesiredSkills : EmployeeDe
[groovyc] ^

这到底是什么意思?就像它没有意识到EmployeeDesiredSkill是一个域类

最佳答案

我假设这是一个grails应用程序,并且您尝试从中使用域类。如果是这样,您需要做
grails编译
而不是直接调用groovyc。通过直接调用groovyc,可以跳过在编译阶段Grails包含所有依赖项的步骤。如果您尝试从普通的常规项目中使用Grails GORM,请参见this link

关于groovy - 用于定义关系的常规静态 block ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3718700/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com