grails-app / utils目录

时间:2010-02-05 20:36:05

标签: grails

我刚刚注意到grails-app/utils目录的存在。我从来没有在任何文档(或在项目中使用)中看到它。它是在你运行create-app时默认创建的,你知道你应该把它放在那里吗?

“实用程序”代码是一个明显的猜测,但似乎应该在src目录下。

谢谢, 唐

1 个答案:

答案 0 :(得分:36)

grails-app/utils/目录是Codecs之类的内容。

我不确定还有什么,但你可以在那里包含其他类,它们将包含在应用程序中

编辑: grails-app/utils/目录适用于“Grails特定实用程序”(ArtefactsGrailsClasses等。)

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