views:

34

answers:

1

I have a couple of domain classes defined, Employee and EmployeeDesiredSkill,

Employee has

 static hasMany = [employeeSkill:EmployeeDesiredSkill]

and EmployeeDesiredSkill has

static belongsTo = [employee:Employee]

Yet groovyc is giving me a bunch of errors like the following:

[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]                                  ^

What does this mean exactly? Its like it doesnt realize EmployeeDesiredSkill is a domain class

+1  A: 

I'm assuming this is a grails application and your trying to use the domain classes from it. If so you need to do grails compile instead of calling groovyc directly. By calling groovyc directly your skipping the steps where Grails includes all it's dependencys during the compilation phase. If your trying to use Grails GORM from a plain groovy project see this link

Jared