Running Groovy

Now that you have Groovy installed, let's introduce some of the tools that come with the Groovy package. Groovy can be compiled into a Java class file and deployed as part of an application, the same as for any other Java class file. In addition to this, Groovy has several tools that allow us to execute a Groovy program as a script without the need to package it into a Java application.

There are three commands that we can use to launch a script. In the following sections, we will demonstrate the different methods of running Groovy scripts. As we progress through the book, you can use these methods to execute the Groovy scripts that we will describe.

The Groovy script engine – groovy

Let's start by writing a Groovy version of the ubiquitous ...

Get Groovy for Domain-specific Languages - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.