Step 1: Grails Installation, Running and Debugging an application
Complete Application using Grails 3
Before installing Grails 3.x you will need as a minimum a Java Development Kit (JDK) installed version 1.7 or above. Download the appropriate JDK for your operating system, run the installer, and then set up an environment variable called JAVA_HOME pointing to the location of this installation.
export JAVA_HOME=/Library/Java/Home export PATH="$PATH:$JAVA_HOME/bin"
On Windows you would have to configure these environment variables in My Computer/Advanced/Environment Variables
For manual installation follow these steps:
· Download a binary distribution of Grails and extract the resulting zip file to a location of your choice
· Set the GRAILS_HOME environment variable to the location where you extracted the zip
o On Unix/Linux based systems this is typically a matter of adding something like the following export GRAILS_HOME=/path/to/grails
to your profile
o On Windows this is typically a matter of setting an environment variable under My Computer/Advanced/Environment Variables
· Then add the bin
directory to your PATH
variable:
o On Unix/Linux based systems this can be done by adding export PATH="$PATH:$GRAILS_HOME/bin"
to your profile
o On Windows this is done by modifying the Path
environment variable under My Computer/Advanced/Environment Variables
If Grails is working correctly you should now be able to type grails -version
in the terminal window and see output similar to this:
Grails version: 3.2.10
You have familiar with Composer and need to install Composer. If not, please see https://getcomposer.org and install composer. After installing composer, go to your htdocs folder and open terminal and run the command To create a Grails application you first need to familiarize yourself with the usage of the grails
command which is used in the following manner:
grails <<command name>>
Run create-app to create an application:
grails create-app helloworld
Running and Debugging an Application
Improve this doc
Grails applications can be run with the built in Tomcat server using the run-app command which will load a server on port 8080 by default:
grails run-app
You can specify a different port by using the -port
argument:
grails run-app -port=8090 When you run the app, it will view in the browse with http://localhost:8090 URL. If you want run again, that time, you need to stop with port as like grails stop-app -port=8090 and execute run command.
For more http://docs.grails.org/latest/guide/gettingStarted.html