Search

Dark theme | Light theme

January 20, 2016

Ratpacked: Running Ratpack In Groovy Console

It is actually very easy to run a Ratpack application in the Groovy Console. The Groovy Console is a GUI application that is distributed with Groovy and allows us to write and run Groovy scripts. We start the Groovy Console with the groovyConsole command: $ groovyConsole. To run a Ratpack application we only have to add a dependency to Ratpack using the @Grab annotation. We can write an application with the Groovy DSL and select Script | Run from the menu. If we make a change in the script file we invoke the Run command again. The Ratpack application restarts with our changes. This is very useful for trying out some Ratpack features without much hassle.

The following screenshot shows a simple Ratpack application. At the bottom we see the logging output of the running application:

Written with Ratpack 1.1.1.