grails 学习过程中遇到的一些问题

来源:互联网 发布:杭州淘宝店集中在哪里 编辑:程序博客网 时间:2024/06/05 23:41

1利用grails generate-all User 时候提示:No domain class found for name Status. Please try again and enter a valid domain class name

解决方法: 使用项目名.Domain名称。

如我的项目为yingtest,User.groovy位于C:\Documents and Settings\Administrator\YingTest\grails-app\domain\yingtest


使用 grails generate-all yingtest.User 问题解决 



2 在创建完domain,service,controller 之后编译报错,创建的domain为User


C:\Documents and Settings\Administrator\YingTest>grails compile
Welcome to Grails 1.3.8 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: C:\Program Files\grails-1.3.8

Base Directory: C:\Documents and Settings\Administrator\YingTest
Resolving dependencies...
Dependencies resolved in 9531ms.
Running script C:\Program Files\grails-1.3.8\scripts\Compile.groovy
Environment set to development
  [groovyc] Compiling 10 source files to C:\Documents and Settings\Administrator
\YingTest\target\classes
  [groovyc] org.codehaus.groovy.control.MultipleCompilationErrorsException: star
tup failed:
  [groovyc] C:\Documents and Settings\Administrator\YingTest\grails-app\conf\Boo
tStrap.groovy: 3: unable to resolve class User
  [groovyc]  @ line 3, column 2.
  [groovyc]     new User(name: "demo", password: "123456").save()
  [groovyc]     ^
  [groovyc]
  [groovyc] 1 error
Compilation error: Compilation Failed


解决方法:修改BootStrap.groovy使用new yingtest.User(name: "demo", password: "123456").save()