Grails default package name

五迷三道 提交于 2019-12-05 12:05:08
Alidad

If I understood your question, you are looking for default package name for your domain classes. In your config.groovy file there is a line saying:

grails.project.groupId = appName

if you give it an appName, Grails will use that as the default package name when it generates the artifacts.

grails.project.groupId = 'com.example.yourpackagename'

If you now create a domain class by default it will locate it under com/example/yourpackagename.

UPDATE

It is not required to use Grails commands like create-domain-class or other commands to create artifacts. These are all just classes that you can manually create. Just create a file and duplicate it in the same package.

UPDATE

Grails interactive mode (when you type grails) for some of the commands by pressing tab it will type ahead the unique portion of the package name.

UPDATE for Grails 3.0

The setting has moved into conf/application.yml:

grails:
   profile: web
   codegen:
      defaultPackage: com.example.yourpackagename
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!