Grails generate-all Example

Use the grails generate-all command to create controller, views, and controller unit tests.

First, define a domain such as the below User.

package wolbay

class User {
String userId
String password
static constraints = {
userId(length:6..8,unique:true)
password(length:6..8)
}
}

Second, from the command line, navigate to the project folder

cd z:\User\Dev10\IdeaProjects\MyProject

Third, execute the generate-all command

grails generate-all wolbay.User

Fourth, evaluate the results

  • Generating views for domain class wolbay.User
  • Generating controller for domain class wolbay.User
  • Created Tests for User
  • Finished generation for domain class wolbay.User

About admin

Richard has worked in the Information Technology field for 25 years on a variety of platforms and lines of business.
This entry was posted in Groovy Grails. Bookmark the permalink.