Setup Grails 3 Development Environment

  1. Download the latest version (or any version) from https://grails.org/
  2. Upzip it to a known directory, d:\grails-3.3.6, for example.
  3. Download and install the required JDK for your Grails version from Oracle. For example, Grails 3.3.6 requires Java JDK 1.8 to run. https://www.oracle.com/technetwork/java/javase/downloads/index.html
  4. Edit either the environment variables for the system or your account. Here I choose my own user variables instead of system variables.
  5. Add GRAILS_HOME, and JAVA_HOME to the path Grails, and Java JDK installed respectively. Then Add %GRAILS_HOME%\bin in the existing Path variable so that your can call the grails' executable in the console.
  6. The installation is completed. To try it out, Open a command prompt.
  7. Go to the directory you want to create the Hello World project. In my case, it is d:\grailsApp. Type the command grails create-app helloworld to create a new project named helloworld.
    D:\grailsApp>grails create-app helloworld
  8. Change directory to the newly create helloworld directory, and type the command grails. Grails will download the require library. It might take sometime for download for the first time. After that, we will enter the grails mode
    D:\grailsApp>cd helloworld
    D:\grailsApp\helloworld>grails
    BUILD SUCCESSFUL
    | Enter a command name to run. Use TAB for completion:
    grails>
  9. To see which commands we can run in grails mode, press Tab key. The interesting one would be assemble, compile, clean, run-app, and stop-app
    grails>
    
    assemble                      bug-report                    clean                         compile
    console                       create-controller             create-domain-class           create-functional-test
    create-integration-test       create-interceptor            create-scaffold-controller    create-script
    create-service                create-taglib                 create-unit-test              dependency-report
    generate-all                  generate-async-controller     generate-controller           generate-views
    gradle                        help                          install                       install-templates
    list-plugins                  open                          plugin-info                   run-app
    schema-export                 shell                         stats                         stop-app
    test-app                      url-mappings-report
    grails>
  10. The Development Environment has now been set up.