grailsgrails-pluginspockgrails-2.3

Grails 2.3.9 - Error: ClassNotFoundException: grails.plugin.spock.test.GrailsSpecTestType


Whenever I enter the grails command: test-app I get this error:

Error executing script TestApp: java.lang.ClassNotFoundException: grails.plugin.spock.test.GrailsSpecTestType (Use --stacktrace to see the full trace)

In my BuildConfig.groovy I have:

grails.project.dependency.resolution = {
    ...
    plugins {
        ...
        test ":spock:0.7"
    }
}

I've tried replacing it with compile ":spock:0.7" . I've also tried cleaning the application and refreshing the dependencies but no luck.

Any ideas what it could be and how I could fix it?

Thanks


Solution

  • for Grails 2.2+ try this code in your BuildConfig:

    grails.project.dependency.resolution = {
      repositories {
        grailsCentral()
        mavenCentral()
      }
      dependencies {
        test "org.spockframework:spock-grails-support:0.7-groovy-2.0"
      }
      plugins {
        test(":spock:0.7") {
          exclude "spock-grails-support"
        }
      }
    }
    

    for more info just check out: https://grails.org/plugin/spock