我正在尝试将我的项目从Grails 2.4移植到3.0。没什么:12个域,13个 Controller 和一个服务。
一切正常,除非我尝试包含Scaffolding插件。我从字面上遵循手册here,但语法必须错误。按指定添加插件行:
plugins {
…
compile ":scaffolding:2.0.0"
…
}
导致此:
BUILD FAILED
Total time: 1.559 secs
| Error Error initializing classpath: startup failed:
build file 'E:\GrailsIdeaProjects\HcaServer\build.gradle': 17: only id(String) method calls allowed in plugins {} script block
See http://gradle.org/docs/2.3/userguide/plugins.html#sec:plugins_block for information on the plugins {} block
@ line 17, column 5.
compile ":scaffolding:2.0.0"
^
1 error
(Use --stacktrace to see the full trace)
有人知道在Grails 3中包括Scaffolding插件的正确语法吗?
编辑:感谢Casey向我指出正确的方向:脚手架插件实际上已经包含在默认的build.gradle中。无论如何,我仍然在每个 Controller 上得到这样的网页:
Error: Page Not Found (404)
Path: /*controllerName*/index
我一直使用与手册相同的语法,在每个 Controller 上声明一个
static scaffold = true
。为什么我会得到404页面?我的 View 文件夹中确实有index.gsp,error.gsp和notFound.gsp。
最佳答案
看来该文档尚未针对Grails 3.0进行更新。您的build.gradle
文件应具有dependencies
块,您可以在其中指定依赖项:
dependencies {
// ...
runtime "org.grails.plugins:scaffolding"
}
您也可以通过使用Grails 3.0创建一个新应用并 checkout 默认的
build.gradle
文件来查看此信息。
关于grails - Grails 3脚手架问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29449417/