找不到错误域 class

Error domain class not found

我可以使用 ($ grails create-app MyDomain) 创建应用程序但无法使用 $ grails generate-all MyDomain.

I made sure that I do have the domain generated with the proper name/spelling (by going physically into the local folder on my machine), all looks ok. The only log I get is the error message that says Error domain class not found ...that's all. I am relatively new to grails. I am following exactly as it instructs in Dzone Refcardz for Grails

SO 上有两个相关问题,但他们没有回答我的问题。

Domain class not found in grails-app/domain

Grails 3.x: Re-using JPA/Hibernate Domain classes: Domain class not found

我唯一的疑问是:我的 osx (yosemite) 上有两个版本的 jdk。我已设置在我的个人资料中使用一个。但我不确定。根据我在网上的阅读,有两个 JDK 不应该 导致错误 $ grails generate-all MyDomain

是否有任何其他途径可以解决这个问题?

我猜这是典型的 'no package provided while creating a domain class' 问题。默认情况下,如果您省略包名称,例如如果您只是创建一个域 class $ grails create-app MyDomain,则 MyDomain.groovy 文件是在 app-name 包下创建的,即 MyApplication.MyDomain.

如果是这样,那么您的 $ grails generate-all MyDomain 实际上应该是 $ grails generate-all MyApplication.MyDomain