Skip to content
Advertisement

Grails scaffolding does show nothing

I use grails 2.4.4

I added dependenci in my BuildConfig:

dependencies {
    test "org.grails:grails-datastore-test-support:1.0.2-grails-2.4"
    compile "org.grails.plugins:scaffolding:2.1.2"
}

and add plugin:

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"
}

Create domain Person:

package person

class Person {

    static constraints = {
    }

    String name
}

And controller:

package person

class PersonController {

    static scaffold = Person
}

Also try to use: static scaffold = true, it also doesn’t work. I try to delete my package target.

But in my url (http://localhost:8090/grails-com.learning/person) I see nothing

enter image description here

There is no the plugin:

enter image description here

Advertisement

Answer

See the project at https://github.com/jeffbrown/adamscaffolding.

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

(there is no need to mention the scaffolding plugin in the dependencies {} block, the plugins {} block is where to express that)

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

package person

class Person {

    static constraints = {
    }

    String name
}

grails-app/controllers/person/PersonController.groovy

package person

class PersonController {

    static scaffold = Person 

}

That scaffolding behaves as intended.

Advertisement