2

jdk 1.8.

Gradle 7.3

In my java project I want to write unit test by Kotlin. So I try this:

in build.gradle:

plugins {
    id 'application'
    id "com.nocwriter.runsql" version "1.0.3"
    id 'idea'
    id "io.spring.dependency-management" version "1.0.11.RELEASE"
    id 'org.jetbrains.kotlin.jvm' version '1.7.10'
}
apply plugin: "io.spring.dependency-management"
dependencies {
    // The dependencies in the BOM will be dependency constraints in our build, but the versions in the BOM are forced for used dependencies.
    implementation enforcedPlatform('org.springframework.boot:spring-boot-dependencies:2.7.2')

    // Use dependency defined in BOM.
    // Version is not needed, because the version defined in the BOM is a dependency constraint that is used.
    implementation 'org.xerial:sqlite-jdbc'
    implementation 'org.jetbrains.kotlin:kotlin-stdlib'
    testImplementation(
            'org.assertj:assertj-core',
            'org.junit.jupiter:junit-jupiter-api'
    )
    testRuntime('org.junit.jupiter:junit-jupiter-engine')

    // This version will be overridden by the one found in the BOM
    implementation 'log4j:log4j:1.2.17'
    implementation 'com.toedter:jcalendar:1.4'
    
}

Usage:

./gradlew build

But I get error in this line:

testRuntime('org.junit.jupiter:junit-jupiter-engine')

Error:

 What went wrong:
A problem occurred evaluating project ':app'.
> Could not find method testRuntime() for arguments [org.junit.jupiter:junit-jupiter-engine] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Alexei
  • 14,350
  • 37
  • 121
  • 240

1 Answers1

1

Change to

testImplementation "org.junit.jupiter:junit-jupiter-engine"
orby
  • 267
  • 4
  • 6