2017-07-10 8 views
3

spekがテストを見つけようとしているうちにクラッシュしています。私は多くの異なるバージョンとサンプルの設定を試しました。私はコマンドラインから実行しています。 Gradle 4.0、mac osx。どんな助けもありがとう!ここでKolin Spek FrameworkがGradleでクラッシュする

は誤りです:

WARNING: TestEngine with ID 'spek' failed to discover tests 
java.lang.NoSuchMethodError: org.junit.platform.commons.util.ReflectionUtils.findAllClassesInClasspathRoot(Ljava/nio/file/Path;Ljava/util/function/Predicate;Ljava/util/function/Predicate;)Ljava/util/List; 
     at org.jetbrains.spek.engine.SpekTestEngine.resolveSpecs(SpekTestEngine.kt:66) 
     at org.jetbrains.spek.engine.SpekTestEngine.discover(SpekTestEngine.kt:50) 
     at org.junit.platform.launcher.core.DefaultLauncher.discoverEngineRoot(DefaultLauncher.java:130) 
     at org.junit.platform.launcher.core.DefaultLauncher.discoverRoot(DefaultLauncher.java:117) 
     at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:90) 
     at org.junit.platform.launcher.Launcher.execute(Launcher.java:96) 
     at org.junit.platform.console.tasks.ConsoleTestExecutor.executeTests(ConsoleTestExecutor.java:65) 
     at org.junit.platform.console.tasks.ConsoleTestExecutor.lambda$execute$0(ConsoleTestExecutor.java:57) 
     at org.junit.platform.console.tasks.CustomContextClassLoaderExecutor.invoke(CustomContextClassLoaderExecutor.java:33) 
     at org.junit.platform.console.tasks.ConsoleTestExecutor.execute(ConsoleTestExecutor.java:57) 
     at org.junit.platform.console.ConsoleLauncher.executeTests(ConsoleLauncher.java:85) 
     at org.junit.platform.console.ConsoleLauncher.execute(ConsoleLauncher.java:75) 
     at org.junit.platform.console.ConsoleLauncher.execute(ConsoleLauncher.java:48) 
     at org.junit.platform.console.ConsoleLauncher.main(ConsoleLauncher.java:40) 

そして、ここでは私の現在のbuild.gradleです:

buildscript { 

repositories { 
    jcenter() 
    maven { url "https://plugins.gradle.org/m2/" } 
} 
dependencies { 
    classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.0-M5' 
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$project.ext.kotlinVersion" 
} 
} 

apply plugin: 'org.junit.platform.gradle.plugin' 
apply plugin: 'idea' 
apply plugin: 'kotlin' 
apply plugin: 'java' 

junitPlatform { 
    filters { 
     engines { 
      include 'spek', 'junit-jupiter', 'junit-vintage' 
     } 
    } 
} 

dependencies { 
    compile("org.jetbrains.kotlin:kotlin-stdlib-jre8:$project.ext.kotlinVersion") 


// testCompile 'junit:junit:4.12' 
    testCompile 'org.jetbrains.spek:spek-api:1.1.2' 
    testRuntime 'org.jetbrains.spek:spek-junit-platform-engine:1.1.2' 
    testCompile 'org.junit.platform:junit-platform-runner:1.0.0-M5' 
    testCompile 'org.junit.jupiter:junit-jupiter-api:5.0.0-M5' 
    testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version" 
    testRuntime "org.junit.vintage:junit-vintage-engine:4.12.0-M5" 
    testRuntime "org.junit.jupiter:junit-jupiter-engine:5.0.0-M5" 
    testRuntime "org.junit.platform:junit-platform-console:1.0.0-M5" 

    testCompile "com.google.code.gson:gson:$project.ext.gsonVersion" 
} 

repositories { 
    mavenCentral() 
} 
+0

を:https://docs.gradle.org/current/release-notes.html一見、SPEKはKotlinを期待以前のバージョンと同様に、Java出力ディレクトリに配置されるクラスこの機能をサポートするには、classesディレクトリを使用するすべてのツールを更新する必要があります。あるいは、以前のGradleバージョンを使用してみてください。 – hotkey

+2

junitプラットフォームのバージョン1.0.0.M4(Spekのドキュメントhttp://spekframework.org/docs/latest/に記載)を試してください.Junitプラットフォームの新しいマイルストーンバージョンでは、APIの変更が時折発生することがあります。 –

+0

@ JKLy。あなたはそれを釘付けにした。ちょうど指示の指示に従わなければならなかった。答えとして投稿し、私は受け入れます。 – Patrick

答えて

7

SPEKを使用すると、JUnitのプラットフォームバージョン1.0.0-M4として使用する必要があります1.1.2 M5には互換性のないAPIの変更があります。

この参照:、異なる言語コンパイラからのクラスが別々のディレクトリに配置されているのGradle 4.0ではhttps://github.com/JetBrains/spek/issues/225

関連する問題