Grails 2.3.5 generate-all doesn't exist but it's in the documentation
Asked Answered
F

3

7

Should it work or has it been removed?

Here's the commands that fail:

grails create-app my_new_app
cd my_new_app
grails generate-all my_new_app.Book

Results in

Script 'GenerateAll' not found, did you mean:.5
   1) CreateFilters
   2) CreateController
   3) CreateIntegrationTest
   4) InstallTemplates
   5) CreateApp_
> Please make a selection or enter Q to quit:

This is according to the documentation at http://grails.org/doc/latest/guide/gettingStarted.html#generatingAnApplication

grails -version
Grails version: 2.3.5
Fin answered 17/2, 2014 at 20:11 Comment(0)
B
16

You need to run

grails compile

Prior to generate-all, as the scaffolding is now in a plugin

Birchfield answered 17/2, 2014 at 20:35 Comment(2)
That seems correct, but don't I also need to run grails create-domain-class book before generate-all? Simply running compile first gave me the error: "No domain class found for name Book."Fin
@Fin yeah generate all just makes controllers and views for a specified existing domain grails.org/doc/latest/ref/Command%20Line/generate-all.htmlBirchfield
F
5

Use the following commands

grails create-app my_new_app
cd my_new_app
grails refresh-dependencies
grails create-domain-class book
grails generate-all my_new_app.Book

This worked for me. I got the idea from the Grails forum: http://grails.1312388.n4.nabble.com/Generate-scripts-missing-from-grails-2-3-3-td4651739.html

Fin answered 17/2, 2014 at 20:19 Comment(1)
As Jason mentions in the comment on Jon Polaski's answer, you have to add compile ":scaffolding:2.1.2" to the plugins section of BuildConfig.groovy before you can use this solution. 2.1.2 was the latest as of writing and it worked with grails 2.5.5 (scaffolding:2.0.0 did not work with 2.5.5 and gave errors similar to plugins/scaffolding-2.0.0/src/java/org/codehaus/groovy/grails/scaffolding/view/ScaffoldedGroovyPageView.java:87: error: method createResponseWriter in class GroovyPageView cannot be applied to given types;)Ley
E
3

The scaffolding feature was pulled from core in Grails 2.3.*. Add the scaffolding plugin to BuildConfig.groovy to restore generate-all and static scaffolding functionality.

compile ":scaffolding:2.0.0"

Extrados answered 8/5, 2014 at 1:56 Comment(1)
I did add that to the BuildConfig and still got the errors. See my answer and @Birchfield answer for what had to happen after this dependency was added.Fin

© 2022 - 2024 — McMap. All rights reserved.