Grails 3脚手架问题
Grails 3 scaffolding issue
我正在尝试将我的项目从 Grails 2.4 移植到 3.0。没什么特别的:12 个域、13 个控制器和一个服务。
一切正常,除非我尝试包含 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 中包含脚手架插件的正确语法吗?
编辑:感谢 Casey 为我指明了正确的方向:脚手架插件实际上已经包含在默认 build.gradle 中。无论如何,我仍然在每个控制器上得到这样的网页:
Error: Page Not Found (404)
Path: /*controllerName*/index
我一直使用与手册相同的语法,在每个控制器上声明 static scaffold = true
。为什么我会得到一个 404 页面?我的视图文件夹中确实有 index.gsp、error.gsp 和 notFound.gsp。
Grails 3.0 的文档似乎尚未更新。您的 build.gradle
文件应该有一个 dependencies
块,您可以在其中指定依赖项:
dependencies {
// ...
runtime "org.grails.plugins:scaffolding"
}
您还可以通过使用 Grails 3.0 创建一个新应用程序并检查默认 build.gradle
文件来查看这一点。
经过一段时间的研究,发现动态脚手架还没有进入 Grails 3:
https://groups.google.com/forum/m/#!topic/grails-dev-discuss/6R2YaF96Uts
试试这个,对我有用。
dependencies {
compile "org.grails.plugins:scaffolding"
}
我正在使用 grails 3.09。
我正在尝试将我的项目从 Grails 2.4 移植到 3.0。没什么特别的:12 个域、13 个控制器和一个服务。 一切正常,除非我尝试包含 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 中包含脚手架插件的正确语法吗?
编辑:感谢 Casey 为我指明了正确的方向:脚手架插件实际上已经包含在默认 build.gradle 中。无论如何,我仍然在每个控制器上得到这样的网页:
Error: Page Not Found (404)
Path: /*controllerName*/index
我一直使用与手册相同的语法,在每个控制器上声明 static scaffold = true
。为什么我会得到一个 404 页面?我的视图文件夹中确实有 index.gsp、error.gsp 和 notFound.gsp。
Grails 3.0 的文档似乎尚未更新。您的 build.gradle
文件应该有一个 dependencies
块,您可以在其中指定依赖项:
dependencies {
// ...
runtime "org.grails.plugins:scaffolding"
}
您还可以通过使用 Grails 3.0 创建一个新应用程序并检查默认 build.gradle
文件来查看这一点。
经过一段时间的研究,发现动态脚手架还没有进入 Grails 3: https://groups.google.com/forum/m/#!topic/grails-dev-discuss/6R2YaF96Uts
试试这个,对我有用。
dependencies {
compile "org.grails.plugins:scaffolding"
}
我正在使用 grails 3.09。