CHAPTER 9Miscellaneous Recipes

In this chapter, I present miscellaneous recipes from different topics. Templating, working with XML, working with files, using regular expressions, using Groovy from the command line, downloading files, writing configuration files in Groovy, and using Groovy to run external processes are some of the examples I present in this chapter.

9-1. How Do I Use Groovy Templates to Generate Dynamic and Reusable Content?

In Recipe 3-1, I showed you how to use GStrings to generate dynamic content that can be useful in templating scenarios. Groovy also has a powerful dedicated template framework with several template engines that can be used to create templates with embedded JSP-like scriptlets and variables (JSP stands for ...

Get Groovy and Grails Recipes 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.