找不到方法使用JUnitPlatform在gradle中测试任务
我正在尝试配置 gradle 以运行 JUnit 5 测试。但是,当我尝试添加我的gradle文件以启用JUnit 5支持时,我得到了错误useJUnitPlatform()
Could not find method useJUnitPlatform() for arguments [] on task ':test' of type org.gradle.api.tasks.testing.Test.
这是我的Gradle文件
apply plugin: 'java'
group 'com.notif'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
jcenter()
maven {
url 'https://packages.confluent.io/maven/'
}
}
tasks.withType(Test) {
testLogging {
exceptionFormat "full"
events "started", "skipped", "passed", "failed"
showStandardStreams true
}
}
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.2.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.2.0'
testImplementation "org.mockito:mockito-core:2.21.0"
implementation 'org.apache.kafka:kafka-streams:1.0.0-cp1'
implementation 'org.apache.kafka:kafka-clients:1.0.0-cp1'
implementation 'org.apache.avro:avro:1.8.2'
implementation 'org.apache.logging.log4j:log4j-core:2.11.0'
implementation 'org.apache.logging.log4j:log4j-api:2.11.0'
implementation 'io.confluent:kafka-streams-avro-serde:4.1.0'
implementation 'biz.paluch.logging:logstash-gelf:1.11.2'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.6'
implementation 'org.asynchttpclient:async-http-client:2.2.0'
implementation 'org.apache.logging.log4j:log4j-jcl:2.11.1'
}
任何想法为什么会发生这种情况,我是否错过了任何依赖性