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.

1

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 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.