首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Grails脚手架不显示任何内容

Grails脚手架不显示任何内容
EN

Stack Overflow用户
提问于 2021-05-20 23:37:24
回答 1查看 43关注 0票数 0

我使用grails 2.4.4

我在我的BuildConfig中添加了依赖项:

代码语言:javascript
复制
dependencies {
    test "org.grails:grails-datastore-test-support:1.0.2-grails-2.4"
    compile "org.grails.plugins:scaffolding:2.1.2"
}

并添加插件:

代码语言:javascript
复制
plugins {
    build ":tomcat:7.0.55"
    compile ":scaffolding:2.1.2"
    compile ':cache:1.1.8'
    compile ":asset-pipeline:1.9.9"

    runtime ":hibernate4:4.3.6.1" // or ":hibernate:3.6.10.18"
    runtime ":database-migration:1.4.0"
    runtime ":jquery:1.11.1"
}

创建域名Person:

代码语言:javascript
复制
package person

class Person {

    static constraints = {
    }

    String name
}

和控制器:

代码语言:javascript
复制
package person

class PersonController {

    static scaffold = Person
}

也试着使用: static scaffold = true,它也不起作用。我尝试删除我的包目标。

但是在我的url (http://localhost:8090/grails-com.learning/person)中我什么也看不到

没有插件:

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-05-21 04:17:24

请访问https://github.com/jeffbrown/adamscaffolding查看该项目。

grails-app/conf/BuildConfig.groovy#L49-L75

(不需要提到dependencies {}块中的脚手架插件,plugins {}块就是用来表达这一点的地方)

代码语言:javascript
复制
dependencies {
    // specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes e.g.
    // runtime 'mysql:mysql-connector-java:5.1.29'
    // runtime 'org.postgresql:postgresql:9.3-1101-jdbc41'
    test "org.grails:grails-datastore-test-support:1.0.2-grails-2.4"
}

plugins {
    // plugins for the build system only
    build ":tomcat:7.0.55"

    // plugins for the compile step
    compile ":scaffolding:2.1.2"
    compile ':cache:1.1.8'
    compile ":asset-pipeline:1.9.9"

    // plugins needed at runtime but not for compilation
    runtime ":hibernate4:4.3.6.1" // or ":hibernate:3.6.10.18"
    runtime ":database-migration:1.4.0"
    runtime ":jquery:1.11.1"

    // Uncomment these to enable additional asset-pipeline capabilities
    //compile ":sass-asset-pipeline:1.9.0"
    //compile ":less-asset-pipeline:1.10.0"
    //compile ":coffee-asset-pipeline:1.8.0"
    //compile ":handlebars-asset-pipeline:1.3.0.3"
}

grails-app/domain/person/Person.groovy

代码语言:javascript
复制
package person

class Person {

    static constraints = {
    }

    String name
}

grails-app/controllers/person/PersonController.groovy

代码语言:javascript
复制
package person

class PersonController {

    static scaffold = Person 

}

该脚手架的行为符合预期。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67623638

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档