3

そのため、これらのツールを一緒に実行しようとしてきましたが、正しくセットアップできないようです。次のエラーが表示されるたびに:

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.

この要点を作成しました。gradle chrome test を実行すると、次の出力が得られます。

 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

Gradle 1.3、geb 0.7.2、spock 0.7-groovy-2.0 を使用しています。また、0.9.0-RC-1 を使用するように geb を更新しようとしました。上記の要点には、この同じエラーを表示するために必要なすべてが含まれているはずです。

4

2 に答える 2

6

これは、Spock 0.7 と互換性のない 0.9.0-RC-1 より前の Geb バージョンで Spock 0.7 を実行した場合に得られるものです。セットアップを再確認し、クリーン ビルドを実行します。

于 2012-12-06T17:54:15.583 に答える
0

私は同じ問題に遭遇していました。Geb/Spock 統合 jar はまだ groovy 2.0 にアップグレードされていないため、groovy 1.8 バージョンを使用する必要があることがわかりました。次の設定は私にとってはうまくいきました:

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'

}

貨物の統合を含む完全なスクリプトをブログに投稿しました: http://www.openscope.net/2015/02/21/how-to-configure-gebspock-with-gradle/

于 2015-02-21T18:55:58.707 に答える