我刚刚注意到grails-app/utils
目录的存在。我从来没有在任何文档(或在项目中使用)中看到它。它是在你运行create-app
时默认创建的,你知道你应该把它放在那里吗?
“实用程序”代码是一个明显的猜测,但似乎应该在src
目录下。
谢谢, 唐
答案 0 :(得分:36)
grails-app/utils/
目录是Codecs之类的内容。
我不确定还有什么,但你可以在那里包含其他类,它们将包含在应用程序中
编辑:
grails-app/utils/
目录适用于“Grails特定实用程序”(Artefacts,GrailsClasses等。)
Jeff Brown(Core member of the Grails development team)回复了question on the mailing list,证实了这一点。他说:
你几乎可以放任何东西 就像在
之下utils
目录中一样 真的是Grails特定的实用程序。 目前我认为唯一的事情 真正针对这个目录的是 自定义编解码器。你的申请 不是Grails工件的类 应该在src/groovy/
您可以在Constriants plugin中找到新Grails Artefact的示例。此插件的作者建议用户put their Constraint classes in the grails-app/utils/
directory。