I’ve been having a great deal of trouble setting up spock to test some groovy classes in my gradle build.
First let me explain the groovy files. I needed the build to run slightly different based on which linux OS it was installed against. The gradle build script determines which OS is running at startup and instantiates a groovy object specific to that OS. I created generic tasks in the gradle.build file that would call methods on the instantiated objects.
I put all the groovy class files in /buildSrc/src/main/groovy/ under the project, and everything just worked.
Recently I’ve tried to add some Spock unit tests as due diligence. When placed in /buildSrc/test/main/groovy I keep getting “unable to resolve class spock.lang.Specification” despite importing spock.lang.* in the spec files, and included the framework through the dependencies in build.gradle.
Is there something simple I could be missing? Is there a good tutorial project for this kind of gradle layout?