Your country

Tools that support it use your country for local currency, number formats, units and paper size. Your choice is saved only in this browser.

Type a name or a two-letter code. Use the up and down arrow keys to move through the countries, Enter to choose one and Escape to close.

Programming languages

Groovy (Jenkins, Gradle and Spock)

Groovy where it runs: Jenkinsfiles and shared libraries, Gradle build scripts, Spock tests and scripts, on Groovy 2.4, 4.0, 5.1 and 6.0, with examples that run.

13 lessons to read 3 modules

13 lessons: 13 free with Pro answers.

Examples run with groovy 6.0.0, groovy5 5.1.3, groovyGradle 4.0.33, groovyJenkins 2.4.21, Java temurin-25.0.4+101.0.LTS, gradle 9.8.0 and spock 2.4-groovy-5.0.

Who it is for

Developers, DevOps and build engineers who meet Groovy in Jenkinsfiles, Jenkins shared libraries, Job DSL, Gradle build scripts and Spock tests, and Java developers who want Groovy for scripting.

What you will be able to do

  • Tell which Groovy runs a Jenkinsfile, a Gradle build, a Spock test or a script, and check the version yourself
  • Write Groovy values, strings, operators and control flow, and predict where the runtimes disagree
  • Use closures with their owner, delegate and resolve strategy, the mechanism behind every Groovy DSL
  • Process collections, files and processes with the Groovy Development Kit and GINQ
  • Model data with classes, traits, records and AST transforms, and choose between dynamic and static typing
  • Build and parse JSON, XML and YAML, and design a small domain-specific language that is safe to run
  • Test Groovy and Java code with Spock, from data-driven features to mocks and extensions
  • Write Jenkins Pipeline Groovy that works with CPS, serialization and the script sandbox
  • Write, test and publish Jenkins shared libraries and Job DSL scripts
  • Read and write Gradle Groovy DSL builds, move them to the Kotlin DSL, and upgrade code to Groovy 6

Revise and practise

Modules and lessons

What the labels mean

Free lesson, Pro answers
the whole lesson is free; the model answers to its interview questions open with a pass
Pro
opens with a Pro, Premium or Ultimate pass

Minutes are reading time.

What a pass opens in this track

26 interview answers. The same pass opens every other track and every Pro tool.

  1. Module 1

    Start here: one language, three Groovy runtimes

    Which Groovy runs a Jenkinsfile, a Gradle build, a Spock test and a script, installing Groovy and running scripts, what changes for Java developers, and reading errors.

    1. Groovy in 2026: one language, three runtimes Beginner Free lesson, Pro answers: 10 minutes
    2. Install Groovy and run your first scripts Beginner Free lesson, Pro answers: 15 minutes
    3. Groovy for Java developers: what changes Beginner Free lesson, Pro answers: 10 minutes
    4. Reading Groovy errors and stack traces Beginner Free lesson, Pro answers: 10 minutes
  2. Module 2

    Core syntax: values, strings, operators and control flow

    Numbers and def, var and val, strings and GStrings, Groovy truth and null safety, operators, ranges and membership, control flow and switch, and regular expressions.

    1. Numbers, variables, def, var and val Beginner Free lesson, Pro answers: 10 minutes
    2. Strings, GStrings and multi-line text Beginner Free lesson, Pro answers: 10 minutes
    3. Groovy truth, null safety and the Elvis operator Beginner Free lesson, Pro answers: 10 minutes
    4. Operators, ranges, spread and membership Intermediate Free lesson, Pro answers: 10 minutes
    5. Control flow, loops and the Groovy switch Beginner Free lesson, Pro answers: 10 minutes
    6. Regular expressions the Groovy way Intermediate Free lesson, Pro answers: 10 minutes
  3. Module 3

    Closures: the engine behind every Groovy DSL

    Closure syntax, parameters and return values, the owner, delegate and resolve strategy, and currying, composition, memoization and capture.

    1. Closures: syntax, parameters and return Beginner Free lesson, Pro answers: 10 minutes
    2. Closure owner, delegate and resolve strategy Intermediate Free lesson, Pro answers: 10 minutes
    3. Currying, composition, memoization and capture Intermediate Free lesson, Pro answers: 15 minutes

Related tools

Official documentation

More in Programming languages

Quick answers and tool search

Type to search tools or to get a quick answer, for example 18% of 2500. Use the up and down arrow keys to move through the results, Enter to choose, and Escape to close.