Groovy

Groovy programming language tutorials, examples, and best practices.

Groovy @Grab Annotation – Practical Recipes with 10+ Examples

Practical Groovy Grab annotation (@Grab) recipes for popular libraries. 12 copy-paste examples: Gson, Apache Commons CSV, OkHttp, JDBC drivers, Jsoup, and more – each with a working script you can run immediately. “The best dependency manager is the one you forget is there – until you need a library at 2 AM and it just downloads itself into your script.” Last Updated: July 2026 | Tested on: Groovy 5.0.6, Java 17+ | Difficulty: Beginner-Intermediate | Reading Time: 16 minutes Grape ... Read More

Groovy Static vs Dynamic – CompileStatic Performance Guide with 10+ Examples

Groovy static compilation performance compared to dynamic Groovy and Java. 13 tested examples with benchmarks, migration strategies, and a guide to choosing static vs dynamic for each part of your codebase. “Dynamic typing lets you move fast. Static typing lets you move fast without breaking things. The trick is knowing which one you need right now.” Last Updated: July 2026 | Tested on: Groovy 5.0.6, Java 17+ | Difficulty: Intermediate-Advanced | Reading Time: 18 minutes “Is Groovy slow?” That is ... Read More

Groovy TimeCategory and Date Manipulation – Cookbook with 10+ Examples

Groovy TimeCategory and date manipulation with 13 tested examples. Write 3.days.ago, 2.hours.from.now, and natural date arithmetic using Groovy’s built-in date DSL and GDK extensions. “There are only two hard things in computer science: cache invalidation and naming things.” Phil Karlton Last Updated: July 2026 | Tested on: Groovy 5.0.6, Java 17+ | Difficulty: Beginner-Intermediate | Reading Time: 18 minutes Our Groovy Date and Time post covers the java.time API – LocalDate, ZonedDateTime, Duration, and the modern approach to dates. This ... Read More