Discover millions of ebooks, audiobooks, and so much more with a free trial

Only $11.99/month after trial. Cancel anytime.

Groovy 2 Cookbook
Groovy 2 Cookbook
Groovy 2 Cookbook
Ebook929 pages5 hours

Groovy 2 Cookbook

Rating: 0 out of 5 stars

()

Read preview

About this ebook

This book follows a Cookbook style and is packed with intermediate and advanced level recipes.This book is for Java developers who have an interest in discovering new ways to quickly get the job done using a new language that shares many similarities with Java. The book’s recipes start simple, therefore no previous Groovy experience is required to understand the code and the explanations accompanying the examples.
LanguageEnglish
Release dateOct 22, 2013
ISBN9781849519373
Groovy 2 Cookbook

Related to Groovy 2 Cookbook

Related ebooks

Programming For You

View More

Related articles

Reviews for Groovy 2 Cookbook

Rating: 0 out of 5 stars
0 ratings

0 ratings0 reviews

What did you think?

Tap to rate

Review must be at least 10 words

    Book preview

    Groovy 2 Cookbook - Andrey Adamovich

    Table of Contents

    Groovy 2 Cookbook

    Credits

    About the Authors

    About the Reviewers

    www.PacktPub.com

    Support files, eBooks, discount offers and more

    Why Subscribe?

    Free Access for Packt account holders

    Preface

    The Groovy language

    What this book covers

    What you need for this book

    Who this book is for

    Conventions

    Reader feedback

    Customer support

    Downloading the example code

    Errata

    Piracy

    Questions

    1. Getting Started with Groovy

    Introduction

    Installing Groovy on Windows

    Getting ready

    How to do it…

    There's more...

    Installing Groovy on Linux and OS X

    How to do it...

    How it works...

    There's more...

    See also

    Executing Groovy code from the command line

    How to do it...

    How it works...

    There's more...

    See also

    Using Groovy as a command-line text file editor

    How to do it...

    How it works...

    There's more...

    See also

    Using Groovy to start a server on the command line

    How to do it...

    See also

    Running Groovy with invokedynamic support

    Getting ready

    How to do it...

    There's more...

    See also

    Building Groovy from source

    Getting ready

    How to do it...

    How it works...

    Managing multiple Groovy installations on Linux

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Using groovysh to try out Groovy commands

    How to do it...

    How it works...

    There's more...

    Starting groovyConsole to execute Groovy snippets

    How to do it...

    There's more...

    Configuring Groovy in Eclipse

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Configuring Groovy in IntelliJ IDEA

    Getting ready

    How to do it...

    There's more...

    2. Using Groovy Ecosystem

    Introduction

    Using Java classes from Groovy

    How to do it...

    How it works...

    There's more...

    See also

    Embedding Groovy into Java

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Compiling Groovy code

    Getting ready

    How to do it...

    How it works...

    See also

    Simplifying dependency management with Grape

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Integrating Groovy into the build process using Ant

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Integrating Groovy into the build process using Maven

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Integrating Groovy into the build process using Gradle

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Generating documentation for Groovy code

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Checking Groovy code's quality with CodeNarc

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    3. Using Groovy Language Features

    Introduction

    Searching strings with regular expressions

    Getting ready

    How to do it...

    There's more...

    See also

    Writing less verbose Java Beans with Groovy Beans

    Getting ready

    How to do it...

    How it works...

    There's more...

    Inheriting constructors in Groovy classes

    How to do it...

    How it works...

    Adding the cloning functionality to Groovy Beans

    How to do it...

    How it works...

    There's more...

    Defining code as data in Groovy

    Getting ready

    How to do it...

    There's more...

    Defining data structures as code in Groovy

    Getting ready

    How to do it...

    How it works...

    See also

    Implementing multiple inheritance in Groovy

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Adding a functionality to the existing Java/Groovy classes

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Defining type-checking rules for dynamic code

    Getting ready

    How to do it...

    How it works...

    There's more...

    Adding automatic logging to Groovy classes

    How to do it...

    How it works...

    There's more...

    See also

    4. Working with Files in Groovy

    Introduction

    Reading from a file

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Reading a text file line by line

    Getting ready

    How to do it...

    There's more...

    See also

    Processing every word in a text file

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Writing to a file

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Replacing tabs with spaces in a text file

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Filtering a text file's content

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Deleting a file or directory

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Walking through a directory recursively

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Searching for files

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Changing file attributes on Windows

    Getting ready

    How to do it...

    How it works...

    There's more...

    Reading data from a ZIP file

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Reading an Excel file

    Getting ready

    How to do it...

    How it works...

    See also

    Extracting data from a PDF

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    5. Working with XML in Groovy

    Introduction

    Reading XML using XmlSlurper

    Getting ready

    How to do it...

    How it works...

    See also

    Reading XML using XmlParser

    How to do it...

    How it works...

    See also

    Reading XML content with namespaces

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Searching in XML with GPath

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Searching in XML with XPath

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Constructing XML content

    How to do it...

    How it works...

    There's more...

    See also

    Modifying XML content

    Getting ready

    How to do it...

    How it works...

    See also

    Sorting XML nodes

    How to do it...

    How it works...

    There's more...

    See also

    Serializing Groovy Beans to XML

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    6. Working with JSON in Groovy

    Introduction

    Parsing JSON messages with JsonSlurper

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Constructing JSON messages with JsonBuilder

    How to do it...

    How it works...

    See also

    Modifying JSON messages

    How to do it...

    How it works...

    See also

    Validating JSON messages

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Converting JSON message to XML

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Converting JSON message to Groovy Bean

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Using JSON to configure your scripts

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    7. Working with Databases in Groovy

    Introduction

    Creating a database table

    Getting ready

    How to do it...

    How it works...

    See also

    Connecting to an SQL database

    Getting ready

    How to do it...

    How it works...

    See also

    Querying an SQL database

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Modifying data in an SQL database

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Calling a stored procedure

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Reading BLOB/CLOB from a database

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Building a simple ORM framework

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Using Groovy to access Redis

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Using Groovy to access MongoDB

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Using Groovy to access Apache Cassandra

    Getting ready

    How to do it...

    How it works...

    See also

    8. Working with Web Services in Groovy

    Introduction

    Downloading content from the Internet

    How to do it...

    How it works...

    There's more...

    See also

    Executing an HTTP GET request

    How to do it...

    How it works...

    There's more...

    See also

    Executing an HTTP POST request

    How to do it...

    How it works...

    There's more...

    See also

    Constructing and modifying complex URLs

    How to do it...

    How it works...

    See also

    Issuing a REST request and parsing a response

    Getting ready

    How to do it...

    How it works...

    See also

    Issuing a SOAP request and parsing a response

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Consuming RSS and Atom feeds

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Using basic authentication for web service security

    How to do it...

    How it works...

    See also

    Using OAuth for web service security

    Getting ready

    How to do it...

    How it works...

    See also

    9. Metaprogramming and DSLs in Groovy

    Introduction

    Querying methods and properties

    Getting ready

    How to do it...

    How it works...

    See also

    Dynamically extending classes with new methods

    How to do it...

    How it works...

    There's more...

    See also

    Overriding methods dynamically

    Getting ready

    How to do it...

    How it works...

    Adding performance logging to methods

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Adding a caching functionality around methods

    Getting ready

    How to do it...

    How it works...

    See also

    Adding transparent imports to a script

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    DSL for executing commands over SSH

    Getting ready

    How to do it...

    How it works...

    See also

    DSL for generating reports from logfiles

    Getting ready

    How to do it...

    How it works...

    There's more...

    10. Concurrent Programming in Groovy

    Introduction

    Processing collections concurrently

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Downloading files concurrently

    Getting ready

    How to do it...

    How it works...

    See also

    Splitting a large task into smaller parallel jobs

    How to do it...

    How it works...

    See also

    Running tasks in parallel and asynchronously

    Getting ready

    How to do it...

    How it works...

    See also

    Using actors to build message-based concurrency

    How to do it...

    How it works...

    See also

    Using STM to atomically update fields

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Using dataflow variables for lazy evaluation

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Index

    Groovy 2 Cookbook


    Groovy 2 Cookbook

    Copyright © 2013 Packt Publishing

    All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

    Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.

    Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

    First published: October 2013

    Production Reference: 1151013

    Published by Packt Publishing Ltd.

    Livery Place

    35 Livery Street

    Birmingham B3 2PB, UK.

    ISBN 978-1-84951-936-6

    www.packtpub.com

    Cover Image by Jarek Blaminsky (<milak6@wp.pl>)

    Credits

    Authors

    Andrey Adamovich

    Luciano Fiandesio

    Reviewers

    Kunal Dabir

    Ayan Dave

    Fergal Dearle

    Eric Kelm

    Guillaume Laforge

    Acquisition Editors

    Kartikey Pandey

    Rebecca Youe

    Lead Technical Editor

    Ankita Shashi

    Technical Editors

    Pragnesh Bilimoria

    Jinesh Kampani

    Sandeep Madnaik

    Chandni Maishery

    Ankita Thakur

    Project Coordinator

    Apeksha Chitnis

    Proofreaders

    Ameesha Green

    Katherine Tarr

    Indexer

    Hemangini Bari

    Graphics

    Ronak Dhruv

    Yuvraj Mannari

    Production Coordinator

    Shantanu Zagade

    Cover Work

    Shantanu Zagade

    About the Authors

    Andrey Adamovich is a software craftsman with many years of experience in different lifecycle phases of software creation. He is passionate about defining good development practices, documenting and presenting architecture, the reuse of code and design patterns, the profiling and analysis of application performance, as well as extreme automation of development and operations activities.

    He is a longtime Groovy user and has a deep knowledge of the language internals. He uses Groovy in his day-to-day development job for simplifying the development process, which includes: code generation, super cool DSLs, and rapid prototyping.

    He has Master's degree in Computer Science from the Latvian State University.

    I would like to thank my wife Lena for her patience and understanding that gave me enough time and energy to focus on the book. Many thanks to my friends, Sergey and Dmitry, who attentively reviewed book chapters and shared their insightful comments. And, of course, I'm very grateful to Luciano for the exciting experience we had together while working on this book.

    Luciano Fiandesio is a programmer, technology enthusiast, and entrepreneur living in Zurich, Switzerland. Luciano has been working for the last 18 years in 12 different countries as an architect and developer for large corporations and small start-ups: Nokia, European Central Bank, BNP Paribas, and Ericsson are among his clients. He loves coding and designing solutions that are both elegant and rock solid. When not busy learning the next big thing, he likes playing with his analog cameras and cooking Italian food. Two years ago, he started a consulting company focused on software factory automation, Aestas IT, where Groovy plays a big role. He holds a Master's degree in Literature and Philosophy from Rome University.

    I'd like to thank Andrey, my business partner, friend, and co-author on this book; Laura, my life partner for her patience; Matteo, my brother, for his help; and Pierluigi for reviewing the book.

    About the Reviewers

    Ayan Dave is a software engineer that takes pride in building and delivering high quality applications using languages and components in the JVM ecosystem. He is passionate about software development and enjoys exploring open source projects. He is enthusiastic about Agile and Extreme Programming, and frequently advocates for them. Over the years, he has provided a consulting service to several organizations and has played many different roles. Most recently, he is the Architectus Oryzus for a project team with big ideas, and he subscribes to the idea that running code is the system of truth.

    He has a Master's degree in Computer Engineering from the University of Houston-Clear Lake and holds PMP, PSM-1, and OCMJEA certifications. He is also a speaker on various technical topics at local user groups and community events. He currently lives in Columbus, Ohio, where he works with Quick Solutions Inc. In the digital world, he can be found at http://daveayan.com.

    Fergal Dearle has been writing code since he started writing BASIC as a bellbottom-wearing teenager in the 70s. The jeans aren't bellbottoms anymore and the code is in Groovy, not BASIC but he's still wearing jeans and he's still coding. Recently, he can be found mostly working on web-based projects in Groovy on Grails as his framework of choice. He is the author of Groovy for Domain Specific Languages and is a passionate advocate of Agile methods.

    Eric Kelm is senior software developer with over nine years of experience as a developer, senior developer, and technical lead, delivering top-notch solutions to customers. His current focus is developing Java web applications, particularly with the Groovy-based Grails framework.

    He holds a Bachelor's degree in Computer Science from the Sam Houston State University. Along with his day-to-day work, he also shares his insights into some of his technical solutions with a broader audience through his blog http://asoftwareguy.com.

    Guillaume Laforge is the project lead of the Groovy language. He works for Pivotal, formerly the SpringSource division of VMware. Guillaume co-authored the Groovy in Action best-seller, and speaks regularly about Groovy, Domain-Specific Languages, and various Groovy related topics at conferences worldwide.

    www.PacktPub.com

    Support files, eBooks, discount offers and more

    You might want to visit www.PacktPub.com for support files and downloads related to your book.

    Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at for more details.

    At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.

    http://PacktLib.PacktPub.com

    Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read and search across Packt's entire library of books. 

    Why Subscribe?

    Fully searchable across every book published by Packt

    Copy and paste, print and bookmark content

    On demand and accessible via web browser

    Free Access for Packt account holders

    If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access.

    Preface

    Groovy 2 Cookbook consists of problem-solving recipes for Groovy, one of the most flexible programming languages we have ever used. Th book contains solutions to more than 100 common problems, shown with more than 500 Groovy code snippets.

    There are a few unique things about this book:

    As a cookbook, it's intended to save your time by providing solutions to the most common problems you'll encounter.

    Most of the examples can be run as Groovy scripts or directly in the GroovyConsole. As a result, whether you're sitting by a computer or n a plane, you get the benefit of seeing their exact output.

    The book covers not only the Groovy language, but also has several recipes on Groovy libraries and tools, including Gradle, concurrent programming and functional testing.

    Th book covers Groovy 2.0 and 2.1.

    The Groovy language

    Groovy arises from the self-imposed limitations of the Java language. Java is an old language, originally conceived in 1990 and released at the beginning of 1996 (Java 1.0). We are looking at a 20 year life span that, in our field, is equivalent to an ice age. Java was portable (remember the motto write once, run anywhere?), sported a truly object-oriented core, and provided an automatic management of memory. The Java platform evolved in two directions: Java Virtual Machine, an outstanding piece of software engineering, which has become increasingly powerful and more performant over the years, and the actual Java language. The latter unquestionably matured and changed since its origin, but it did so in a unnerving slow-motion pace. The reason for this pondered evolution lies in the strong ties that the Java language historically had with the enterprise world. This bond acted as a double-edged weapon. It gave the language the massive adoption and popularity that it enjoys today, but it tampered the ability to quickly adapt to an ever-changing IT landscape.

    In order to counteract the lethargic adoption of new features in Java, new languages based on the JVM started to see the light. Groovy is one of these languages, along with Scala, Clojure, JRuby, Jython and many others. So what is Groovy? Groovy is an optionally typed, dynamic language for the JVM with many features influenced by languages Python, Ruby, and Smalltalk, making them available to Java developers using a Java- syntax. Groovy is designed to work seamlessly with Java at every level, from syntax alignment to bytecode generation (although it creates different bytecode). The language evolved from being a limited scripting language to a fully-fledged programming language that can be used in very different contexts, such as web applications and services, backend servers, background jobs, desktop applications.

    The dynamic nature of the language allows a degree of flexibility hardly achievable with Java. Thanks to the language's metaprogramming features, it is possible to modify or augment the code and behavior at runtime or even at compile time (using AST) and create Domain-Specific Languages (DSL) in a breeze. Furthermore Groovy adds a huge number of convenience methods and approaches that simplify your code and make it more powerful.

    We, the authors, have been programming in Groovy for many years now. We hope that through this book, we will be able to convey the great fun and productivity boost that we enjoyed by using this language.

    What this book covers

    Chapter 1, Getting Started with Groovy, covers the installation process on different operating systems and the basic tools that come with the language distribution.

    Chapter 2, Using Groovy Ecosystem, introduces the Groovy ecosystem—a set of tools for compiling, embedding, building, documenting and running code analysis with Groovy.

    Chapter 3, Using Groovy Language Features, shows the different facets of the Groovy language that allows you to write a terser, readable and less ceremonious code in comparison to Java.

    Chapter 4, Working with Files in Groovy, covers I/O with Groovy, from simple cases such as reading a file to more complex endeavors mining data from a PDF file or an Excel spreadsheet.

    Chapter 5, Working with XML in Groovy, introduces you to recipes that discuss how to consume and produce XML, as well as more advanced topics such serialization.

    Chapter 6, Working with JSON in Groovy, covers Groovy's native support for reading and producing JSON documents.

    Chapter 7, Working with Databases in Groovy, presents recipes related to data persistence, either through a relational SQL database or a NoSQL data store.

    Chapter 8, Working with Web Services in Groovy, explains how to use Groovy to interact with SOAP and REST-based web services.

    Chapter 9, Metaprogramming and DSLs in Groovy, covers advanced metaprogramming concepts such as dynamically extending classes with new methods, creating DSLs, and using AST transformation to modify the code at compilation time.

    Chapter 10, Concurrent Programming in Groovy, introduces you to the GPars framework and several approaches to execute tasks concurrently.

    Chapter 11, Testing with Groovy, covers how to use Groovy for testing not only code using unit tests, but also databases, web services and the performance of your application. This chapter is available online at: http://www.packtpub.com/sites/default/files/downloads/Testingwithgroovy.pdf.

    What you need for this book

    In order to be able to run the examples in the book, you will need the Java Development Kit 1.6 or newer, and 2.0 (or higher) of Groovy.

    Who this book is for

    This book is for Java and Groovy developers who have an interest in discovering new ways to quickly get the job done using the Groovy language, which shares many similarities with Java. The book's recipes start simple, therefore no extensive Groovy experience is required to understand and use the code and the explanations accompanying the examples. Some advanced recipes assume that the reader already has the necessary background to understand the topic at hand (for example, general knowledge of computer science, data structures, complexity, concurrent programming). Moreover, the recipes are often just skeletons that aim to provide essential information for getting started, but which require the reader to do more research to fill in the details. As such, it is assumed that the reader knows how to use search engines and how to access Groovy's online documentation.

    Conventions

    In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

    Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: It also ensures that the reader object gets closed after the method returns.

    A block of code is set as follows:

    class Person {

      String name

      String lastName

    }

     

    p = new Person()

    Any command-line input or output is written as follows:

    groovy -e throw new Exception() Caught: java.lang.Exception java.lang.Exception         at script_from_command_line.run(script_from_command_line:1)

    New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text this: Click on the Advanced system settings to open the System Properties window.

    Note

    Warnings or important notes appear in a box like this.

    Tip

    Tips and tricks appear like this.

    Reader feedback

    Feedback from our readers is always welcome. Let us know what you think about this book—what you d or may have dis. Reader feedback is important for us to develop titles that you really get the most out of.

    To send us general feedback, simply send an e-mail to <feedback@packtpub.com>, and mention the book title via the subject of your message.

    If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

    Customer support

    Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

    Downloading the example code

    You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

    Errata

    Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

    Piracy

    Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

    Please contact us at <copyright@packtpub.com> with a link to the suspected pirated material.

    We appreciate your help in protecting our authors, and our ability to bring you valuable content.

    Questions

    You can contact us at <questions@packtpub.com> if you are having a problem with any aspect of the book, and we will do our best to address it.

    Chapter 1. Getting Started with Groovy

    In this chapter, we will cover:

    Installing Groovy on Windows

    Installing Groovy on Linux and OS X

    Executing Groovy code from the command line

    Using Groovy as a command-line text file editor

    Using Groovy to start a server on the command line

    Running

    Enjoying the preview?
    Page 1 of 1