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
Jason
  • 11,709
  • 9
  • 66
  • 82

3 Answers3

16

You need to run

grails compile

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

tim_yates
  • 167,322
  • 27
  • 342
  • 338
  • 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." – Jason Feb 17 '14 at 20:53
  • @Jason yeah generate all just makes controllers and views for a specified existing domain http://grails.org/doc/latest/ref/Command%20Line/generate-all.html – tim_yates Feb 17 '14 at 21:01
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

Jason
  • 11,709
  • 9
  • 66
  • 82
  • 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;`) – Colin D Jul 11 '16 at 17:32
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"

Jon Polaski
  • 134
  • 2
  • 3
  • I did add that to the BuildConfig and still got the errors. See my answer and @tim_yates answer for what had to happen _after_ this dependency was added. – Jason May 09 '14 at 02:24