Grails - Interactive Mode



Description

It runs the JVM and provides the commands for quicker execution. Type the grails at command line to activate the interactive mode and use the TAB completion to specify the different command types.

D:\Projects\helloworld>grails
grails>

You can also create a service by using the below command:

 
grails> create-service [name]

For instance, we will create a service class "team" and "players" will be the associated unit test for the given base name:

D:\Projects\helloworld>grails
grails> create-service team.players
| Rendered service class to grails-app/services/team/PlayersService.groovy
| Rendered service class to src/test/groovy/team/PlayersServiceSpec.groovy
grails>

The above command creates the service under grails-app/services folder and its associated unit test of a service will be created under src/test folder.

You can list down the other commands to run external process by using the below command:

 
grails> ls
Unmatched argument at index 0: 'ls'
Usage: grails [-hvVx] [COM
MAND]
Grails CLI command line interface for generating projects and services.
Application generation commands are:

*  create-app NAME
*  create-webapp NAME
*  create-restapi NAME
*  create-plugin NAME
*  create-webplugin NAME

Options:
  -h, --help         Show this help message and exit.
  -v, --verbose      Create verbose output.
  -V, --version      Print version information and exit.
  -x, --stacktrace   Show full stack trace when exceptions occur.

Commands:
  create-app           Creates an application
  create-webapp        Creates an application
  create-plugin        Creates an Grails Plugin
  create-web-plugin    Creates an Grails Web Plugin
  create-restapi       Creates an REST API
  create-interceptor   Creates a Interceptor Class
  create-controller    Creates a Grails Controller
  create-taglib        Creates a Grails TagLib
  create-service       Creates a Service Class
  create-domain-class  Creates a Domain Class
grails>

To exit from the interactive mode, use the exit command which will exit from the interactive mode console by terminating the JVM.

 
grails> exit
D:\Projects\helloworld>
grails_command_line.htm
Advertisements