3
votes

So I've been attempting to get these tools running together, but I can't seem to get things setup properly. Each time I am presented with the following error:

The project was not built since its build path is incomplete. Cannot find the class file for org.spockframework.mock.MockController. Fix the build path then try building this project.

I've created this gist. When I run gradle chrome test I get the following output:

 gradle chrome test
 :compileJava UP-TO-DATE
 :compileGroovy UP-TO-DATE
 :processResources UP-TO-DATE
 :classes UP-TO-DATE
 :compileTestJava UP-TO-DATE
 :compileTestGroovy FAILED

 FAILURE: Build failed with an exception.
 * What went wrong:
 Execution failed for task ':compileTestGroovy'.
 > org/spockframework/mock/MockController

 * Try:
 Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

 BUILD FAILED

I'm using gradle 1.3, geb 0.7.2 and spock 0.7-groovy-2.0. I've also tried updating geb to utilize 0.9.0-RC-1. The gist above should have everything needed to see this same error.

2

2 Answers

6
votes

This is what you get when you run Spock 0.7 with Geb versions lower than 0.9.0-RC-1 (which aren't compatible with Spock 0.7). Double check your setup and perform a clean build.

0
votes

I was running into the same problem. It turns out you need to use the groovy 1.8 version because the Geb/Spock integration jars haven't been upgraded to groovy 2.0 yet. The following setup worked for me:

dependencies {

    def seleniumVersion = "2.42.2"
    def phantomJsVersion = '1.1.0'
    def cargoVersion = '1.4.9'

    // selenium drivers
    compile "org.seleniumhq.selenium:selenium-ie-driver:$seleniumVersion"
    compile "org.seleniumhq.selenium:selenium-chrome-driver:$seleniumVersion"
    compile "org.seleniumhq.selenium:selenium-firefox-driver:$seleniumVersion"
    compile "org.seleniumhq.selenium:selenium-support:$seleniumVersion"
    compile("com.github.detro.ghostdriver:phantomjsdriver:$phantomJsVersion") {
        transitive = false
    }

    // geb
    compile 'org.codehaus.geb:geb-core:0.7.2'
    compile 'org.codehaus.geb:geb-spock:0.7.2'

    // spock
    compile 'org.spockframework:spock-core:0.6-groovy-1.8'

    compile 'junit:junit:4.8.2'
    compile 'org.slf4j:slf4j-log4j12:1.7.6@jar'
    compile 'org.slf4j:slf4j-api:1.7.6@jar'

}

I posted my full script that includes cargo integration on my blog: http://www.openscope.net/2015/02/21/how-to-configure-gebspock-with-gradle/