A.3. Master example for Maven, Ant, and Gradle

Your first stop regarding Spock installation should be the Spock-example GitHub repository (https://github.com/spockframework/spock-example). This full project with Spock tests contains build files for Gradle, Maven, and Ant (depending on your build system, you may not need all of them). All my instructions for the next sections are extracted from this project.

All code listings in this appendix are segments of the pom.xml file located in that repository. I summarize the instructions for Maven and Gradle.[1] I assume that you already have a Java project up and running and you want to add Spock tests.


Ant isn’t a build system. It’s a relic of the past and should die in flames. If you’re starting ...

Get Java Testing with Spock now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.