title: Geb-Spock using wrong Groovy version
body: <p>When I try to create a functional test using:</p>
  <p><code>grails create-functional-test acceptance.tests.Logout</code></p>
  <p>I'm getting this error, because Spock tries to use a wrong Groovy version:</p>
  <blockquote>
  <p>| Error Failed to compile GenerateAsyncController.groovy: startup failed:
  Could not instantiate global transform class org.spockframework.compiler.SpockTransform specified at jar:file:/Users/reinaldoluckman/.gradle/caches/modules-2/files-2.1/org.spockframework/spock-core/2.0-M2-groovy-3.0/396867de1bbbe11e85e197c22f0e6de07643185a/spock-core-2.0-M2-groovy-3.0.jar!/META-INF/services/org.codehaus.groovy.transform.ASTTransformation  because of exception org.spockframework.util.IncompatibleGroovyVersionException: The Spock compiler plugin cannot execute because Spock 2.0.0-M2-groovy-3.0 is not compatible with Groovy 2.5.6. For more information, see <a href="http://docs.spockframework.org" rel="nofollow noreferrer">http://docs.spockframework.org</a>
  Spock artifact: file:/Users/reinaldoluckman/.gradle/caches/modules-2/files-2.1/org.spockframework/spock-core/2.0-M2-groovy-3.0/396867de1bbbe11e85e197c22f0e6de07643185a/spock-core-2.0-M2-groovy-3.0.jar
  Groovy artifact: file:/Users/reinaldoluckman/.sdkman/candidates/grails/4.0.4/lib/org.codehaus.groovy/groovy/jars/groovy-2.5.6.jar</p>
  </blockquote>
  <p>But in my project only Groovy 3 is a library.</p>
  <p>Here is my build.gradle:</p>
  <pre><code>
  buildscript {
      repositories {
          jcenter()
          mavenCentral()
          mavenLocal()
          maven { url &quot;https://plugins.gradle.org/m2/&quot; }
          maven { url &quot;https://repo.grails.org/grails/core&quot; }
      }
      dependencies {
          classpath &quot;org.grails:grails-gradle-plugin:$grailsVersion&quot;
          classpath &quot;com.bertramlabs.plugins:asset-pipeline-gradle:3.2.5&quot;
          classpath &quot;org.grails.plugins:hibernate5:${gormVersion - '.RELEASE'}&quot;
          classpath &quot;org.grails.plugins:views-gradle:2.1.0.M1&quot;
          classpath &quot;gradle.plugin.com.energizedwork.webdriver-binaries:webdriver-binaries-gradle-plugin:$webdriverBinariesVersion&quot;
      }
  }
  
  plugins {
      id &quot;com.moowork.node&quot; version &quot;1.1.1&quot;
      id &quot;com.github.ben-manes.versions&quot; version &quot;0.33.0&quot;
  }
  
  version &quot;0.1&quot;
  group &quot;test_project&quot;
  
  apply plugin:&quot;eclipse&quot;
  apply plugin:&quot;idea&quot;
  apply plugin:&quot;war&quot;
  apply plugin:&quot;org.grails.grails-web&quot;
  apply plugin:&quot;org.grails.grails-gsp&quot;
  apply plugin:&quot;org.grails.plugins.views-json&quot;
  apply plugin:&quot;asset-pipeline&quot;
  apply plugin:&quot;io.spring.dependency-management&quot;
  apply plugin:&quot;com.energizedwork.webdriver-binaries&quot;
  
  repositories {
      jcenter()
      mavenCentral()
      mavenLocal()
      maven { url &quot;https://plugins.gradle.org/m2/&quot; }
      maven { url &quot;https://repo.grails.org/grails/core&quot; }
  }
  
  dependencyManagement {
      imports {
          mavenBom &quot;org.grails:grails-bom:$grailsVersion&quot;
      }
      applyMavenExclusions false
  }
  
  configurations {
      developmentOnly
      runtimeClasspath {
          extendsFrom developmentOnly
      }
  }
  
  dependencies {
  
      developmentOnly(&quot;org.springframework.boot:spring-boot-devtools&quot;)
  
      implementation &quot;org.springframework.boot:spring-boot-starter-logging&quot;
      implementation &quot;org.springframework.boot:spring-boot-autoconfigure&quot;
      implementation &quot;org.springframework.boot:spring-boot-starter-actuator&quot;
      implementation &quot;org.springframework.boot:spring-boot-starter-tomcat&quot;
      implementation &quot;org.grails:grails-dependencies&quot;
      implementation &quot;org.grails:grails-web-boot&quot;
      implementation &quot;org.grails:grails-core&quot;
      implementation &quot;org.grails:grails-datastore-rest-client:6.1.12.RELEASE&quot;
      implementation &quot;org.grails:grails-logging&quot;
      implementation &quot;org.grails.plugins:cache&quot;
      implementation &quot;org.grails.plugins:scaffolding&quot;
      implementation &quot;org.grails.plugins:hibernate5:${gormVersion - '.RELEASE'}&quot;
      implementation &quot;org.hibernate:hibernate-ehcache&quot;
      console &quot;org.grails:grails-console&quot;
      profile &quot;org.grails.profiles:web&quot;
      runtime(&quot;org.springframework.boot:spring-boot-properties-migrator&quot;)
      runtime &quot;com.bertramlabs.plugins:asset-pipeline-grails:3.2.5&quot;
      runtime &quot;com.h2database:h2&quot;
  
      testImplementation &quot;org.grails:grails-gorm-testing-support:$testingVersion&quot;
      testImplementation &quot;org.grails:grails-web-testing-support:$testingVersion&quot;
      testImplementation &quot;org.grails.plugins:geb&quot;
      testRuntime &quot;org.seleniumhq.selenium:selenium-chrome-driver:$seleniumVersion&quot;
      testRuntime &quot;org.seleniumhq.selenium:selenium-firefox-driver:$seleniumVersion&quot;
      testRuntime &quot;org.seleniumhq.selenium:selenium-safari-driver:$seleniumSafariDriverVersion&quot;
      testImplementation &quot;org.seleniumhq.selenium:selenium-remote-driver:$seleniumVersion&quot;
      testImplementation &quot;org.seleniumhq.selenium:selenium-api:$seleniumVersion&quot;
      testImplementation &quot;org.seleniumhq.selenium:selenium-support:$seleniumVersion&quot;
  
      implementation &quot;com.github.jsimone:webapp-runner:9.0.27.1&quot;
      implementation &quot;org.grails.plugins:spring-security-core:4.0.2&quot;
      implementation &quot;org.grails.plugins:spring-security-rest:3.0.1&quot;
      implementation &quot;org.grails.plugins:postgresql-extensions:5.3.0&quot;
      implementation &quot;org.grails.plugins:views-json:2.1.0.M1&quot;
      implementation &quot;org.grails.plugins:mail:3.0.0&quot;
      implementation 'io.github.http-builder-ng:http-builder-ng-core:1.0.3'
      runtime &quot;org.postgresql:postgresql:42.2.11&quot;
  
      // Para tirar os warnings do application.yml
      implementation &quot;org.springframework.boot:spring-boot-configuration-processor&quot;
  }
  
  webdriverBinaries {
      chromedriver &quot;$chromeDriverVersion&quot;
      geckodriver &quot;$geckodriverVersion&quot;
  }
  
  tasks.withType(Test) {
      systemProperty &quot;geb.env&quot;, System.getProperty('geb.env')
      systemProperty &quot;geb.build.reportsDir&quot;, reporting.file(&quot;geb/integrationTest&quot;)
      systemProperty &quot;webdriver.chrome.driver&quot;, System.getProperty('webdriver.chrome.driver')
      systemProperty &quot;webdriver.gecko.driver&quot;, System.getProperty('webdriver.gecko.driver')
  }
  
  springBoot {
      mainClassName = 'test_project.Application'
  }
  
  bootRun {
      jvmArgs('-Dspring.output.ansi.enabled=always')
      sourceResources sourceSets.main
  }
  
  
  assets {
      minifyJs = true
      minifyCss = true
      includes = [&quot;fonts/*&quot;]
  }
  
  processResources.dependsOn(['npmInstall', 'npm_run_bundle'])
  assetCompile.dependsOn(['npmInstall', 'npm_run_bundle'])
  
  
  task stage() {
      dependsOn clean, war
  }
  
  tasks.stage.doLast() {
      delete fileTree(dir: &quot;build/distributions&quot;)
      delete fileTree(dir: &quot;build/assetCompile&quot;)
      delete fileTree(dir: &quot;build/distributions&quot;)
      delete fileTree(dir: &quot;build/libs&quot;, exclude: &quot;*.war&quot;)
  }
  war.mustRunAfter clean
  
  task copyToLib(type: Copy) {
      into &quot;$buildDir/server&quot;
      from(configurations.compile) {
          include &quot;webapp-runner*&quot;
      }
  }
  
  stage.dependsOn(copyToLib)
  
  
  </code></pre>
  <p>Here is gradle.properties:</p>
  <pre><code>grailsVersion=4.1.0.M2
  groovyVersion=3.0.6
  gormVersion=7.1.0.M2
  gradleWrapperVersion=6.6.1
  testingVersion=2.2.0.M2
  gebVersion=3.4
  seleniumVersion=3.12.0
  webdriverBinariesVersion=1.4
  chromeDriverVersion=86.0.4240.22
  geckodriverVersion=0.23.0
  seleniumSafariDriverVersion=3.14.0
  </code></pre>
  <p>How can I make Spock (that is a transitive dependency from Geb) to use the Groovy 3 (that is already in my classpath)?</p>
  <p>Thanks in advance.</p>