2.8 Running and Debugging an Application

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:

  1. grails run-app

You can specify a different port by using the -port argument:

  1. grails run-app -port=8090

Note that it is better to start up the application in interactive mode since a container restart is much quicker:

  1. $ grails
  2. grails> run-app
  3. | Grails application running at http://localhost:8080 in environment: development
  4. grails> stop-app
  5. | Shutting down application...
  6. | Application shutdown.
  7. grails> run-app
  8. | Grails application running at http://localhost:8080 in environment: development

You can debug a grails app by simply right-clicking on the Application.groovy class in your IDE and choosing the appropriate action (since Grails 3).

Alternatively, you can run your app with the following command and then attach a remote debugger to it.

  1. grails run-app --debug-jvm

More information on the run-app command can be found in the reference guide.