找不到参数[org.junit.jupiter:junitjupiter engine]的方法testRuntime()



jdk 1.8。

7.3级

在我的java项目中,我想由Kotlin编写单元测试。所以我试试这个:

内置.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'

}

用法:

./gradlew build

但我在这行遇到错误:

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

错误:

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.

更改为

testImplementation "org.junit.jupiter:junit-jupiter-engine"

相关内容

最新更新