我刚刚注意到 grails-app/utils
的存在目录我从未在任何文档(或在项目中使用)中看到它被提及。它是在您运行 create-app
时默认创建的,知道你应该在那里放什么吗?
“实用程序”代码是一个明显的猜测,但似乎应该在 src
下。目录
谢谢,
大学教师
最佳答案
grails-app/utils/
目录是诸如 Codecs 之类的项目所在的位置走。
我不确定那里还有什么,但是您可以在那里包含其他类,它们将包含在应用程序中
编辑:grails-app/utils/
目录用于“Grails 特定实用程序”( Artefacts 、 GrailsClasses 等)
Jeff Brown( Core member of the Grails development team ) 回复了 question on the mailing list这证实了这一点。他说:
You can put just about anything you like in the
utils
directory but it is really for Grails specific utilities. At the moment I think the only thing really targeted at this directory are custom codecs. Your application classes that are not Grails artifacts should go undersrc/groovy/
您可以在 Constriants plugin 中找到一个新的 Grails Artefact 示例。 .本插件作者推荐用户put their Constraint classes in the
grails-app/utils/
directory .
关于grails-app/utils 目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2210241/