cannot find method useJUnitPlatform for test task in gradle

B0rn2C0de :

I am trying to configure gradle to run JUnit 5 tests. however, when I try to add useJUnitPlatform() in my gradle file to enable JUnit 5 support as Directed here gradle docs I am getting the error

Could not find method useJUnitPlatform() for arguments [] on task ':test' of type org.gradle.api.tasks.testing.Test.

Here is my Gradle File

    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'
}

Any Idea why this is happening, am I missing any dependency

Kinmarui :

If you are using IntelliJ it is worth checking which Gradle are you using for given project (can be wrapper, task, local). To do so go to Settings and search for Gradle. Then navigate to Build,Execution,Deployment -> Build Tools -> Gradle

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=37010&siteId=1